PDA

View Full Version : problem with 16f877 and display



Steve S.
- 14th January 2007, 17:22
I'm getting trouble with a HD44780 compatible lcd display
and a pic16f877a that doesn't work togheter!
Display it's ok when connected to another circuit made around a PIC16f628

Data and control signals are on port "A"

data are from A0 to A3
RS is on A5
E is on A4

at the top of the program i put the following defines

(In the program there aren't other assignment for PORT A)

//

DEFINE LCD_DREG PORTA 'LCD data port

DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4

DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 5 'LCD register select bit

DEFINE LCD_EREG PORTA 'LCD enable port
DEFINE LCD_EBIT 4 'LCD enable bit

DEFINE LCD_BITS 4 'LCD bus size 4 or 8

DEFINE LCD_LINES 2 'Number lines on LCD

DEFINE LCD_COMMANDUS 2000 'Command delay time in us

DEFINE LCD_DATAUS 50 'Data delay time in us

//

then the first output on LCD is simply made using:

//
PAUSE 1000

LCDOUT $FE,1, "TEST LCD"
//



result: no output on LCD


what's wrong !?!?!?!?




Steve

mat janssen
- 14th January 2007, 18:03
When this is all you programmed, then you forgot sommething.
When you do nothing else then this in your programm, the A port is complete an analog port. (see datasheet)
Try
ADCON1 = 7
maybe it helps!

Steve S.
- 14th January 2007, 18:12
Damn!

i forgot it wasting the time checking in the wrong way.....


thanks a lot Mat...

Archangel
- 14th January 2007, 19:48
Hi Steve,
PortA.4 has open drain output, I believe will require external pullup resistor.
JS

Steve S.
- 15th January 2007, 21:53
Problem solved.... it work!!!

first i forgot to define ADCON1 = 7 and the pull-up resistor
on A4 (open drain) (thanks to Mat and Joe)

Then another error found was on

DEFINE LCD_DBIT 4

instead of

DEFINE LCD_DBIT 0

Thanks for help......

Steve