Page 1 of 1

Strange LCD Problem

Posted: Tue Jan 24, 2012 9:20 am
by mrclauds
Hey guys

I have a strange problem...
I've got a RFID terminal running with an LCD that I need to alter the coding...
The flow code is as follows:

String Manipulation
LCD Start
RFID Initialise
LCD cursor set
Connection Point
String Maipulation
LCD clear
LCD Print ASCII
1s Delay
While Loop

If I delete the while loop and everything after, and remove the then invalid connection point, then the LCD displays nothing.
If I put a while loop just before the programmed while loop, the LCD shows nothing.
If I start a new program, setup connections as need be... I cant get LCD to display anything?

Can anyone shed some light on this for me?

Thanks

Re: Strange LCD Problem

Posted: Tue Jan 24, 2012 12:51 pm
by Benj
Hello,

Best way to get started is to create a one second flasher program.

This is a loop containing a output high to a pin, a second delay, an output low to the pin and another second delay.

There are then two settings to get your hardware to run at the right speed.

1) Clock speed setting in the Project Options window. Ensure this matches your crystal frequency.

2) Configuration settings in the Chip -> Configure menu.

Once you have your program configured correctly so the hardware is running as expected things like the LCD will just start up and work.

Re: Strange LCD Problem

Posted: Tue Jan 24, 2012 5:41 pm
by mrclauds
Hi Benj

Still to no avail...
These are my details and what i've tried...
PIC16F877A
20mhz Oscillator
LCD:
data 1 A2
data 2 A3
data 3 A4
data 4 A5
RS A0
Enable A1

My clock speed has been tried at 20000000 and 19660800
I'm running HS with everything else diabled and off in chip options
Oscillator at 20.0002

Tried:

Output: A0,1 - delay 1s - A0,0 - delay 1s - LCD start - LCD Clear - LCD Cursor -LCD Print Ascii "hello"
Output: C0,1 - delay 1s - C0,0 - delay 1s - LCD start - LCD Clear - LCD Cursor -LCD Print Ascii "hello"

Output: Cport,255 - delay 1s - Cport,0 - delay 1s - LCD start - LCD Clear - LCD Cursor -LCD Print Ascii "hello"
Output: Aport,255 - delay 1s - Aport,0 - delay 1s - LCD start - LCD Clear - LCD Cursor -LCD Print Ascii "hello"

Tried chip clock = XT (though it cant be that)
Power up timer on and off

I thought it might be my circuit, but then surely the LCD wouldnt come on with my other program?

Re: Strange LCD Problem

Posted: Tue Jan 24, 2012 6:41 pm
by Benj
Hello,

How did you get on with the 1 second flasher test? This should not involve the LCD.

Also pin RA4 requires a pull up resistor to allow it to source current. This could be why your display isn't working. A resistor of around 1 - 10K between +V and RA4 should work.

Might also be worth testing on Port B if your unsure.

When the 1 second flasher test is running on the hardware at 1 second intervals then your working LCD program should just look like this.

LCD start - LCD Print String "hello"

Re: Strange LCD Problem

Posted: Fri Jan 27, 2012 11:30 am
by mrclauds
Hi Benj

The flasher test works perfectly...
I made a breadboard to test LCD on PortB and that works perfectly...
Must be the resistor missing... Never read that in the data sheet though?

Still confuses me though...
The LCD displays on PortA with no problems when I've got my entire program loaded, but does not when I delete half the program? Nothing else is changed...

Re: Strange LCD Problem

Posted: Fri Jan 27, 2012 2:10 pm
by Benj
Hello,
The LCD displays on PortA with no problems when I've got my entire program loaded, but does not when I delete half the program? Nothing else is changed...
Hm that's odd. Maybe it's a single icon / combination of icons that is causing the issue. If you can narrow it down to what is causing the problem then I would be interested to find out.