I'm still not sure how to connect the datalines from the display to the PIC (is it DB0 = D7 and so on or is it DB0 = D4 and so on).
Here is my code:
Code:
'PIC 16F88
' LCD circuitery
'23,24,25,26,32,33,34,35,40 - Vdd (+5V)
'27,38 - Vss (GND)
'28 DB0 - PORTA.0
'29 DB1 - PORTA.1
'30 DB2 - PORTA.2
'31 DB3 - PORTA.3
'39 RS - PORTA.4
'36 E - PORTA.6
'37 R/W - PORTA.7
DEFINE LCD_DREG PORTA 'LCD data port
DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 4 'LCD register select bit
DEFINE LCD_EREG PORTA 'LCD enable port
DEFINE LCD_EBIT 6 'LCD enable bit
DEFINE LCD_RWREG PORTA 'LCD read/write port
DEFINE LCD_RWBIT 7 'LCD read/write bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
' Register settings
OSCCON = %01100000 'Internal RC set to 4MHZ
ANSEL = %00000000 'Disable Analogue Inputs
OPTION_REG = %01000000 'Enable PORTB pullups
START:
Lcdout $FE, 1 'Clear screen
MAIN:
pause 1000
lcdout $FE, 2, "This is line one"
lcdout $FE, $C0, "This is line two"
goto MAIN
end
Bookmarks