Troubleshooting LCD4Bit

Hi, I'm trying to use the LCD4Bit library with a very old display with a Hitachi HD44780A46 chip.

I tried the LCD4Bit because I heard it had greater compatibility with older displays. (I tried the LiquidCrystal library and could not get it to work either.)

It's been a long time since I have messed with this type of hardware so I'm a bit rusty.

I believe that I have everything connected properly, but the LCD had all of it's pixels turned on when I power up the Arduino and this never changes. Any ideas what I should try next?

Thanks in advance for any and all help!

(Forgot to mention I'm running the LCD4Bit example code. Didn't want to introduce any of my own bugs before getting it working. ;D)

That sounds like you don't have the correct contrast voltage on the LCD pin 3. Try rotating the contrast pot (you need to have a pot connected to +5v and Gnd with the center going to pin 3). Rotated to one side you should see all the pixel blocks, the other side the pixels cannot be see, somewhere in between you should see your characters.

I guess I need to rustle up a contrast pot. I tested both with the contrast pin tied to +5V and GND with similar results. Just when it was tied to GND the pixels were not as bright.

I'm thinking that some of the research I did on older LCDs might be true of this one. It seems that I may have to get the contrast voltage below ground. I looked at a datasheet for the LCD controller but it did not mention that. However, the datasheet was not for m y exact controller. I think it may be so far out of production that the datasheets are not available online.

Does anyone out there have or know where I can get a datasheet for a Hitachi HD 44780A46?

There is a good chance it will work just like a standard HD44780A. Try it with a pot!

I have the same problem with a brand-new SparkFun LCD-00790. This is a 16x2 LCD with HD44780 chipset, and it's not the contrast pot, as I have that working fine. The display just shows one line of 16 all-on squares. Nothing else, no matter what example code I use...

Oh, and the results (or non-results) are the same whether I use the LiquidCrystal or LCD4Bit library.

Very frustrating! Any suggestions? I currently have a Boarduino set up exactly as described in the LadyAda tutorial. The results were the same on a Duemilanove.

If you have a multitmeter, measure the voltage on the contrast pin and make sure it can vary between 0 and 5 volts. And check that all the pins are actually wired as they should be. I know from my own experience and others, its very easy to overlook a wiring error, even if you think you have double checked.

Good luck!

Finally got my 10K trim pot for the contrast and it only allows me to make all of the dots brighter or dimmer.

I have also ohmed out all of the connections and they are correct.

Any other suggestions?

Yeah, I'd checked all those, they were fine. I figured out the problem, though. The LCD4Bit copy I was using was initially set up for a different set of pins. I had changed LCD4Bit.cpp to reference the pins I was using, but hadn't deleted LCD4Bit.o so the arduino loader was still using the old setup.

Take-home message: any time you change LCD4Bit.cpp, delete LCD4Bit.o and restart Arduino.

To avoid problems likt that to start with I just wired up the LCD the way it is defined in the CPP file..... at least I think. I may have the data bits backward, but I would expect that to give garbage characters. But then again the commands would be garbled too.

Does this look right for the data bits:

DB4 = pin 7 DB5 = pin 8 DB6 = pin 9 DB7 = pin 10 E = pin 2

Sailing_Nut, Ayars post is one more more of many where the problems were caused by the wiring not matching code. My only remaining suggestion is to ask someone else to check everything – the datasheet pinouts, wiring and code.

Good luck!

edit: I was writing the above when you posted your previous reply.

Yes, my copy of LCD4bit uses those pins

Good point, I'll see if someone else's eyes can find a mistake that I made.

I'll also go back over the pinouts for the LCD because it is a surplus one and I couldn't find a datasheet. I just ohmed out the header pins to the HD44780.

Thanks for all of your suggestions!

I finally got it working but by using the LiquidCrystal library.

I have not been able to get the LCD4Bit library to work. (I used the 8 bit version of the LiquidCrystal.)

I had originally tried the LiquidCrystal library, but think i might have had problems because I was using pin 1 for one of the lines and I'm nut sure if that pin can be used for general digital I/O or if it's dedicated to serial Tx as it is labeled on my board.

Good to hear you have it working. Yes, pin one is used for the serial port so best avoided for connecting to an LCD.

Sailing_Nut:

The official LiquidCrystal library in Arduino v12-15 does not use the recommended 'software initialization' for the LCD controller. The library relies on the internal reset circuitry of the LCD controller to do the initialization, which only works properly if the power supply meets certain criteria.

The 4-bit LCD library (neillzero) makes an attempt at the 'software initialization' but has some (in my opinion) errors that most likely cause problems.

floresta