Having trouble with LCD

For users of Matrix Multimedia Electronics software to discuss projects, circuits and any other electronics concepts.

Moderators: Benj, Mods

Post Reply
Evan Long
Posts: 8
Joined: Tue Feb 10, 2009 2:20 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

Having trouble with LCD

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Having trouble with LCD

Post 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?

Evan Long
Posts: 8
Joined: Tue Feb 10, 2009 2:20 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Having trouble with LCD

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Having trouble with LCD

Post 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

Evan Long
Posts: 8
Joined: Tue Feb 10, 2009 2:20 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Having trouble with LCD

Post by Evan Long »

Thanks
I will give that a go.
Much appreciated for the quick response.

Evan Long
Posts: 8
Joined: Tue Feb 10, 2009 2:20 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Having trouble with LCD

Post 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

Post Reply