PDA

View Full Version : 18f4520 lcd problem



merlinknight
- 1st March 2007, 18:16
Hello, i am a newbie on this and was working on the 18f452. It was going great. I installed an 18f4520 to replace the 18f452 and now the lcd does not work.
Any help would greatly be appreciated. Can't figure out why.
I am not using the pro version . On order.

DEFINE OSC 4


DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 3
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_RWREG PORTA
DEFINE LCD_RWBIT 2

ADCON1=$07
TRISA = $00
TRISD = $00
PORTA.2 = 0
PAUSE 500

LOOP:
LCDOUT $FE, 1
PAUSE 1000
LCDOUT $FE, $0F
PAUSE 1000
LCDOUT $FE, $80,"Hello "
PAUSE 5000
LCDOUT $fe, $c0,";)"
PAUSE 5000

GOTO LOOP

mister_e
- 1st March 2007, 18:43
PDF datasheet, page 226, section 19-2 , ADCON1 register

ADCON1=$0F

merlinknight
- 2nd March 2007, 04:03
GREAT! Thank you very much. I kept looking but did not find this.
I don't understand why its causing the problem though. Looks like none of the pins are analog capable. Using pins RDO - RD6 for LCd display.
THANKS AGAIN.
Merlin Knight

skimask
- 2nd March 2007, 04:49
GREAT! Thank you very much. I kept looking but did not find this.
I don't understand why its causing the problem though. Looks like none of the pins are analog capable. Using pins RDO - RD6 for LCd display.
THANKS AGAIN.
Merlin Knight

None of the Port D pins are analog capable, but the Port A pins (your LCD control) are...
Have another look at the datasheet...

merlinknight
- 3rd March 2007, 16:43
You are correct. My bad. Thanks again for the help.

Merlin Knight