Problems with a LCD Module

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hello friends,

I'm working on a remote controlled, PIC powered audio preamp.

It will have an LCD display: so I'm trying to make it work. I wrote some LCD routines for the PIC, but most of them were written by a friend of mine, that tried them and they work.

But instead of displaying characters, it displays those strange symbols:

An externally hosted image should be here but it was not working when we last tested it.

(sorry for the low-quality photo)

What's that? I checked and those symbols aren't chinese, and they aren't on the LCD module character ROM.

So, do I have a broken LCD module? Or what else?

I'm using a KS0066-based LCD module, and a 16F877A PIC. Obviously the PIC works, and it appears that on the LCD there is the right number of character, and also the display's functions (return to line 1, go to line 2, cursor blink...) DO work. Only the characters are screwed up.

I have an identical module here, will try to swap them and see if it work.

What can it be?

Thanks in advance for anyone who wants to help.
 
Ex-Moderator
Joined 2005
It looks like they both work but the pixel mapping is incorrect. Notice how you see the same "character" in the same position on both LCDs. You mentioned your friend wrote the LCD routines you're using. What LCD did he write them for and what LCD are you using? How exactly does the PIC control the LCD? Are you writing to it too fast?

On the hardware side, check carefully for solder bridges on the LCD and around the PIC processor.
 
Hello Brian!

thank you very much for your answer. First I would like to say I'm trying various display initialization routines, from various sources (all for HD44780 compatible displays, and all for 4-bit data transfer), from the web, from the HD44780 datasheet, from the KS0066 datasheet, etc etc... they all look about the same, and I'm following them closely, with all the needed delays inbetween cycles, etc etc.

I also have to add that since I posted, I disconnected the unusued data LCD bits (d0...d3, unusued in 4bit mode) from ground. I was told to connect them to ground, but the datasheet and some internet tutorials and faqs say to leave them unconnected (internal pullups, they say). But still nothing, only strange characters.

Note that now the two LCDs don't follow the same strange symbols: now the simbols are different (however the same number of symbols).
And sometimes they change the symbol randomly on some PIC reset, or some power off.

To answer your questions,

1) my friend write the routines for a 16x2 LCD, very similar to those above. He's helping me, and even with good PIC experience, he's as puzzled as me.

2) The PIC does control the LCD with the data bits on PORTD (it's a PIC16F877A, and yes I disabled all the features on the ports I'm using, such as parallel port, serial ports, A/D converter, comparators, etc etc...). The LCD enable bit, and the RS bit (register select) are on PORTC bit 4 and 5. RS has a pull-up.

3) On the PIC side, there aren't solder bridges because I'm testing it on a breadboard. On the LCD, I checked several and several time, I couldn't find any problem.

A bit puzzled :whazzat:
 
Ex-Moderator
Joined 2005
Hi Giaime. I'll come right out and say I'm not much of a coder. In fact, I barely know enough to be dangerous.

Giaime said:
Note that now the two LCDs don't follow the same strange symbols: now the simbols are different (however the same number of symbols).
And sometimes they change the symbol randomly on some PIC reset, or some power off.

The symbols are different, but notice how they're same for certain positions on both displays. For example, positions 2, 3, and 4 are the same on the one LCD and are a different pattern on the second LCD but are the same for those positions. That means the PIC is telling the LCD to display the same thing for both LCDs, however the command is not being interpreted correctly by the LCD controller.

Giaime said:
My friend write the routines for a 16x2 LCD, very similar to those above. He's helping me, and even with good PIC experience, he's as puzzled as me.

The LCD enable bit, and the RS bit (register select) are on PORTC bit 4 and 5. RS has a pull-up.

Is this the datasheet for the LCD controller? --> http://www.datsi.fi.upm.es/docencia/Micro_C/lcd/ks0066u.pdf

Are you sure it is configured for 4-bit bus mode (DL = 0)? Look at page 15 of the datasheet I linked to above to see the function set control bits. Also, it says "When in 4-bit bus mode it needs to transfer 4-bit data twice."
 
Hello!

The symbols seem to be pretty random. Now, for example, they are all the same on each LCD, but different between the two:

An externally hosted image should be here but it was not working when we last tested it.


The datasheet you linked is the right one. For the LCD initialization, I followed very strictly the procedure at page 27, but it didn't work. Now, maybe I made some changes, so I'm going to rewrite the initialization procedure, following the datasheet. I will report later...

edit: re-did the routine the same as the datasheet says, and nothing: still the same results, as in the photo above.
 
Many LCD modules have some user programmable CG locations. It may be that your code is addressing one of those locations and displaying the random stuff that is normally there until you program it with something non-random. Check your code and make sure you haven't mixed up the CG row and column addresses.

If you're using a PIC MCU you can use the free Maestro program from Microchip's web site to automatically generate the code required to address and control the LCD module. You tell it a few deatils about the module such as whether the interface is 4 or 8 pins, which port it is connected to, etc., and it generates a group of subroutines you can access to write to the module. I've used it a couple times and it works well.

I_F
 
Thanks to everyone has answered. I tried to follow al suggestions... but nothing.

So I decided to wire the controllers in 8-bit mode:

An externally hosted image should be here but it was not working when we last tested it.


at least I know for sure they work! :D

I'm trying to understand what went wrong. Because I don't know yet if I have the space to work in 8bit mode with the LCD, I will use a smaller PIC in the definitive project (PIC16F876A) and I don't know if I have free pins available.

I'll let you know how the thing proceeds. Thanks to anyone! ;)
 
BWRX said:


Hi Giaime. I suspect that you weren't sending data properly to the LCD controller in 4bit mode since it works fine in 8bit mode. Were you transferring the higher 4bits then the lower 4bits or vice versa?

Hi Brian, nice to read you. I was transferring the most significant part of the 8bit first, then the rest. I mean, first bit 7 to 4, then a clock cicle on the "enable" pin, then the bits from 3 to 0, with another cicle. As the datasheet says :rolleyes:

I will do more experiments: since in the 8bit routines I see some things that I cannot yet fully understand. Maybe they will unlock the key for the solution :)
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.