Hi all,
I'm trying to drive my LCD module (2x16 ATM1602B with driver S6A0069) from PIC16F88. I spent 2 days on this, but I can't display any character on LCD. I checked connections many times, it is correct.
Only thing I see is the first line containing blank squares. I've read several post with this topic, and it seems to be a problem with LCD init.
I tried the same code and circuit in Proteus and it works perfectly. But in real nothing
.
Does anyone have an idea how to initialize LCD properly in PicBasic pro? Or if you see any other error please let me know.
My connections are:
D4-D7 .... RB0-RB3
RS ......... RB4
E ........... RB5
RW ........ Ground
Vo ........ Pot against Ground (approx 0.8 V)
Code:
@ DEVICE INTRC_OSC_NOCLKOUT & WDT_OFF & PWRT_OFF & MCLR_OFF & BOD_ON & LVP_OFF & PROTECT_OFF
' Define LCD registers and bits
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50 ' 1000
DEFINE OSC 4
OSCCON = %01100110 ' internal 4MHz
OPTION_REG = $7f
ANSEL = 0
CMCON = 7
FLAGS = 0
Pause 500 ' Wait for LCD to startup
mainloop:
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 500 ' Wait .5 second
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 500 ' Wait .5 second
Goto mainloop ' Do it forever
I would appreciate any help,
many thanks,
regards,
Paul
Bookmarks