16 x 2 LCD works but not 20 x 4

Hello Everyone;

I am having an issue getting a 20 x 4 Kyocera LCD to work properly. I setup the “hello world” circuit and program which works fine with the 16 x 2 LCD from radio shack. When I connect the 20 x 4 LCD, all I get is gobbledygook. I tried a few different programs with no luck. I then hooked both LCD’s to the same circuit and again, the 16 x 2 works but not the 20 x 4. I feel I am missing something simple yet can’t figure it out. I have attached a picture of the circuit and the LCD datasheet. My code is as follows:

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
lcd.print(“hello, world!”);
}

void loop() {

}

Any help would be appreciated

1017131142.jpg

51847add_drawing.pdf (95.1 KB)

This is an excellent setup for troubleshooting and you have chosen a good program to test it with (nothing in loop).

Your circuit is obviously wired correctly since the 'good' display is downstream from the 'bad' display so they both must be getting the correct signals on the correct pins.

This means that there is a problem with the 20x4, most likely a timing problem. One thing you could try is adding 4 more wires and trying the 8-bit configuration. With some displays the LiquidCrystal library has been known to work OK in the 8-bit mode when it didn't work in the 4-bit mode.

You could also try a different library, there are at least two that I think may work. There's the New LiquidCrystal library here --> https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home and LiquidCrystal1.0 here --> Google Code Archive - Long-term storage for Google Code Project Hosting.

Don

01100101 -> 01010110
00100001 -> 01000010
01110010 -> 00100110
01101111 -> 01110110

I may have misplaced a bit there, but it looks a little as if the order of the nybbles is delayed by one.

I can only surmise that the library is expecting a faster response than that driver chip fancies.

It certainly might work better in 8-bit mode. I note that it translates the "l"s consistently.

I think it is broken! Take it back!

Thank you for the suggestions. Here is an update:

  • I tried the new libraries with the same result - the 16 x 2 worked while the 20 x 4 didn’t.

  • I tried a new 20 x 4 LCD - same problem

  • I connected the 20 x 4 in 8 bit mode - everything worked

So 8 bit mode works but 4 bit mode does not. That has me stumped. Maybe it is a timing issue. I really need to get it working in 4 bit mode.

Are you sure that the LiquidCrystal1.0 library doesn't work? When he wrote the original version of that library (LiquidCrystal440) John made sure that it worked with some really slow LCDs that didn't work with other libraries.

Don

Floresta;

Per your post, I re-downloaded the library and this time it worked. Maybe I just didn't install in correctly the first time. Thank you.

Thank You to everyone, I now have it working in 4 bit mode

joncad:
I re-downloaded the library and this time it worked. Maybe I just didn't install in correctly the first time. Thank you.

Presumably didn't install it at all the first time. Libraries don't randomly change like that - I would say you have now actually swapped one library for another which has timing that happens to support your odd display - and it is odd.

There is a frequent question as to whether the controller requires a slight delay between the loading of the first and second nybble. Since your problem actually was incorrect handling of the second nybble, I have to conclude that your new library contains that delay necessary for that particular display. (Clearly, not having the delay is not going to cause trouble, just slow things down).