2x16 LCD doesn't show values, please help
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
Re: 2x16 LCD doesn't show values, please help
Is your chip running? Can you blink an LED at the expected rate?
What is your OSC setup?
And never trust a sim..
http://www.picbasic.co.uk/forum/show...9313#post99313
Re: 2x16 LCD doesn't show values, please help
Hi Dave,
I'm not sure I understand you correctly. Chip is running, I put LED on all data pins D4-D7 and R/S as well and it blinks 0.5s interval (some of them didnt blink, just keeped HIGH). I also tried to start-up PIC later than LCD to get LCD powered properly, but still the same.
I use internal oscillator on 4MHz. This is the first time I use LCD, so please excuse some misunderstandings.
Thank you,
Pavel
Re: 2x16 LCD doesn't show values, please help
ok.
Try disabling the pull ups and play with the contrast.
Re: 2x16 LCD doesn't show values, please help
I think Dave means put an LED on a pin and drive it on before the LCD statement and a pause of 1 second and off after the LCD statement and a 1 second pause.
With this you know the processor is running AND at the correct speed (if it flashes for 1 second)
Re: 2x16 LCD doesn't show values, please help
Hi guys,
ok, thank you, I will test it and let you know. Unfortunately, I'm not able to program the PIC now, it seems my JDM programmer failed :(.
I have to fix it and let you know.
Many thanks,
Paul
Re: 2x16 LCD doesn't show values, please help
Hi,
success !! :)
Finally LCD shows values. I had to use external 4MHz crystal with 33p capacitors connected to ground. I also tried to tune OSCCAL settings, but without success. Now LCD shows what I want.
Thank you very much,
Paul