Eventually I moved the data lines on PORTC and voila, the LCD is displaying characters as it should. Thank you guys for the help.
Here is the working code:
Code:
' display a message on the lcd
'--- defines
DEFINE OSC 8
DEFINE LCD_DREG PORTC ' portb is the port used for data lines
DEFINE LCD_DBIT 4 'the pin on port connected to LCD pin DB4
DEFINE LCD_RSREG PORTA 'pic port used for the RS line
DEFINE LCD_RSBIT 4 ' port pin where RS pin is connected
DEFINE LCD_EREG PORTB ' PIC port where E pin is connected
DEFINE LCD_EBIT 3 ' port pin where E pin is connected
DEFINE LCD_BITS 4 ' 4 bit mode
DEFINE LCD_LINES 2 ' 2 LCD lines
DEFINE LCD_COMMANDUS 2000 'delay between LCD commands
DEFINE LCD_DATAUS 50 'delay between data sent
'--- register configs
adcon1=$0F ' all digital i/o
trisb=0 ' portb all outputs
trisa=0 'porta all outputs
trisc=0
intcon2.7=0 ' enable pullups
osccon=$70 ' oscilator configure
'--- main program
PAUSE 1000 ' pause to let the LCD initialise
repeta:
high portb.0 ' light led to see when main loop is running
LCDOUT $fe,1 ' Clears LCD
LCDOUT $fe,2, "hello" ' Returns to beginning of line 1 and writes "string"
LCDOUT $fe, $C0, "world" ' line 2
pause 1000 ' pause to see it
goto repeta ' do this forever
Bookmarks