LCD Character 8-bit Interface sample code.
'----------------------------------------------------------------------------- '8_bit_character.bas 'Character LCD Dot-Matrix Module '8 Bit interface ' 'DB7-DB0 is P1.7-P1.0 'E is P3.4 active LOW 'WR is P3.7 'D/I is P3.0 ' '----------------------------------------------------------------------------- Declare Sub Writecom Declare Sub Writedata Dim A As Byte Dim Count As Byte '----------------------------------------------------------------------------- Reset P3.4 Waitms 100 'INIT------------------------------------------------------------------------- A = &H30 Call Writecom 'wake up Waitms 100 Call Writecom 'wake up Waitms 10 Call Writecom 'wake up Waitms 10 A = &H38 'function set Call Writecom A = &H10 'shift display=no Call Writecom A = &H0C 'display on Call Writecom A = &H06 'entry mode set Call Writecom '----------------------------------------------------------------------------- Do A = &H01 'home Call Writecom Restore Dta1 For Count = 1 To 16 Read A Call Writedata Next Count A = &HC0 'second line Call Writecom Restore Dta2 For Count = 1 To 16 Read A Call Writedata Next Count Wait 5 Loop End Dta1: Data "Newhaven Display" Dta2: Data " Character LCD " '----------------------------------------------------------------------------- Sub Writecom P1 = A Reset P3.0 'instruction Set P3.4 'E Reset P3.7 'RW Waitms 1 Reset P3.4 'E Set P3.7 'RW End Sub Sub Writedata P1 = A Set P3.0 'data Set P3.4 'E Reset P3.7 'RW Waitms 1 Reset P3.4 'E Set P3.7 'RW End Sub