PDA

View Full Version : LCD problem on portC



BobSpencerr
- 26th February 2007, 00:37
Hi,

I have had a 16x2 LCD display attached to a 16F877 to port A and is works just fine using the default settings for data port etc. The problem is that I have to move it to port C to allow me the use of the A2D converters on the chip. I have tried to assign the port and simply duplicated the wiring to the new pins (left the old ones attached for comparison reasons) but the display will not work.

Is this correct?

Portc.0 to portc.3 = data lines.
PortD.0 = RS
portD.1 = E

DEFINE LCD_DREG PORTC
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50

Why would this not work?

mister_e
- 26th February 2007, 00:47
unless you misswired smething, there's no reason

i just tried it here... work a treat.

BobSpencerr
- 26th February 2007, 01:58
Thanks Mr E.
Ill double check the wiring tonight but as I simply duplicated it from one port to another (and left the previous wires intact for checking against) I doubt that I miss-wired it.

I will check the connections with a cro tonight adn see if signals are getting out.

Did you do anything else (initialise the port or something)

mister_e
- 26th February 2007, 02:06
nope, just placed a PAUSE 500 before the first LCDOUT.

lucky guy you are, i still have what i used...


@ __CONFIG _XT_OSC & _LVP_OFF
'
DEFINE LCD_DREG PORTC
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50

pause 500
lcdout $FE,1,"hello"
stop

BobSpencerr
- 26th February 2007, 02:28
Thanks,
Ill try again tonight.

BobSpencerr
- 28th February 2007, 05:14
Problem solved.
I moved it to another port.