Page 1 of 1

Having trouble with LCD

Posted: Tue Feb 10, 2009 2:35 pm
by Evan Long
Hi
I have a displaytec LCD with a HD44780 compaitible controller. This is attached to port D on 16F877, (data1) RD0, (data2) RD1, (data3) RD2, (data4) RD3, (RS) RD4 and (/E) RD5. RW line to GND, (data1) RD0 goes to data4 on the display RD1 to data5 upto data7 on the display to RD3 etc . The display is 20x4. At present the 1st and 3rd lines show a single bar at the top of the display at all charachter positions. The flowcode3 simulates everything ok. The LVP is dissabled when the 16F877 is programed. Any ideas. (display does work when used previously with 16F877 and assembly code program, rewired it for 4 bit mode).
Regards
Evan

Re: Having trouble with LCD

Posted: Tue Feb 10, 2009 4:54 pm
by Benj
Hello Evan

Ok the single bars you are seeing are the signs of an uninitialised device.

As the device is unitialised this can mean that A) you are not calling the LCD Initialise function in your program or b) You are running your device at the correct speed.

Supposing that you are calling an initialise function in your code I would assume that option B is the cause of your problem. Make sure that the chip configuration settings match the hardware and that the delays in the LCD controller code matches the clock speed driving the chip.

Are you using Flowcode to develop your code or are you using one of our courses or are you using another source of code?

Re: Having trouble with LCD

Posted: Wed Feb 11, 2009 3:22 pm
by Evan Long
Hi thanks for the reply.
Have used flowcode to develope the code, I have got the correct processor clock speed(xtal set correctly) and have also tried another flowcode project using a 2 line display from the same manufacturer, this time we have strange letters and symbols appearing on the 1st line. Have in both uses of the flowcode initilised the lcd 1st as per the clock example using the 16f877. I shall try setting the clock speed (to 10Mhz) for the clock example and rewire the display to portB and compiling to hex and program the 16f877.
I am probably trying to run before I can walk, it looks so intuative when you are simulating things.
Regards
Evan

Re: Having trouble with LCD

Posted: Wed Feb 11, 2009 3:44 pm
by Benj
Hello Evan

My advice would be to perform the flashing LED test. Create a simple loop with a second delay output a 1 to a pin with a LED connected, then wait another second and switch off the pin. This will confirm that your program is runnin gon the hardware at the correct speed. Once you have done this then recheck your pin connections both in Flowcode and on your hardware. Then the last thing I can suggest is provide the LCD manufacturer and I will check out their timing characteristics compared with the standard devices.

Hopefully we'll have you up running and climbing trees in no time :P

Re: Having trouble with LCD

Posted: Thu Feb 12, 2009 11:10 am
by Evan Long
Thanks
I will give that a go.
Much appreciated for the quick response.

Re: Having trouble with LCD

Posted: Wed Feb 18, 2009 2:25 pm
by Evan Long
As you expected, fuse configuration on programmer. Taking your advice flashing led works on 16F84 and 16F877 as a suggested starting point. Demo clock 16F877 appears to function with lcd display, although running fast, giving it a test now.
Compiled clock example as is appart from clock speed and proccesor type for 16F877 and 16F874, with both the LCD diplay works but the clock is runing very fast, ie 24Hrs is done in about 3Hrs 20mins approximately. Do I have to modify the inturupt timer value if I change the defualt clock speed of 19Mhz(ish).
Regards
Evan