Here is some code I used to control the 4x40 display. This is just the LCD part that demonstrates the enable selection
Code:'**** LCD ******************************************************* 'Set LCD Data port DEFINE LCD_DREG PORTB 'Set starting Data bit (0 or 4) if 4-bit bus DEFINE LCD_DBIT 4 'Set LCD Register Select port DEFINE LCD_RSREG PORTB 'Set LCD Register Select bit DEFINE LCD_RSBIT 0 'Set LCD Enable port DEFINE LCD_EREG PORTB 'Set LCD Enable bit DEFINE LCD_EBIT 3 'LCD RW Register PORT 'DEFINE LCD_RWREG PORTB 'LCD read/write pin bit 'DEFINE LCD_RWBIT 5 'Set LCD bus size (4 or 8 bits) DEFINE LCD_BITS 4 'Set number of lines on LCD DEFINE LCD_LINES 4 'Set command delay time in us DEFINE LCD_COMMANDUS 2000 'Set data delay time in us DEFINE LCD_DATAUS 50 LCD1_Disable var portb.2 LCD2_Disable var portb.1 '*** Program variables ***************************************** lcdcnt var byte lcdlen var byte lcdline var byte lcd var byte lcdfunction var byte '*************************************************************** ' Initialize LCD input LCD1_Disable input LCD2_Disable LCDOut $fe,1 'clear lcd pause 100 LCDOut $fe,2 'home LCDOut $fe,$0c 'Curser off LCDOut " USB 4X40 LCD " LCDOut $FE,$C0 LCDOut " DAVE CUTLIFF " low LCD1_Disable input LCD2_Disable LCDOut $fe,1 'clear lcd LCDOut $fe,2 'home LCDOut $fe,$0c 'Curser off LCDOut " Highspeed USB Project " LCDOut $FE,$C0 LCDOut " August 2005 " pause 100 goto idleloop




Bookmarks