PDA

View Full Version : LCD Interfacing for 16F877A



sycluap
- 15th December 2007, 16:36
Hi, I am new to PIC and was working on a school project. The problem is, I am unable to make my LCD work. My LCD model is RT1602C. Below is my codes. Can any expert out there to let me know what is wrong?

Define LCD_DREG PORTB
Define LCD_DBIT 0
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 2
Define LCD_BITS 8
Define LCD_LINES 2
Define LCD_COMMANDUS 2000
Define LCD_DATAUS 50

LCDOUT $FE, 1, "Hello"
LCDOUT $FE, $C0, "World"

end

Thanks in advance!

Darrel Taylor
- 15th December 2007, 19:04
Hi sycluap,

Define LCD_DREG PORTB
Define LCD_DBIT 0
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 2
Define LCD_BITS 8
Define LCD_LINES 2
Define LCD_COMMANDUS 2000
Define LCD_DATAUS 50

ADCON1 = 7 ; Set analog pins to Digital
PAUSE 500 : LCDOUT $FE, 1 : PAUSE 250 ; Initialize LCD

LCDOUT $FE, 1, "Hello"
LCDOUT $FE, $C0, "World"

end<hr>
For more info ...

PortA Doesn't Work / Parts of PortE do not work (Melanie)
http://www.picbasic.co.uk/forum/showthread.php?t=561

sycluap
- 16th December 2007, 03:46
No matter how I try before this, it just can't work, with a few additional line of codes provided by you, everything happen perfectly, it's miracle! Meaning that the cause of the failure is I didn't set the analog pins to digital? I will take note of that from now on.

Thank you very much DT! You save my day!

Darrel Taylor
- 16th December 2007, 04:12
Wooho, and I'll pass that on to Melanie.

I think the first time I ever heard it was from her about 10 years ago on the old PicBasic-L mailing list.

Dang she was smart for only 10 years old then. :)
<br>