Go Down

Topic: LiquidCrystal 4x16 lines (Read 2470 times) previous topic - next topic

zahadum

Hi,

Using the LiquidCrystal library for a 4x16 lines lcd I discovered that  the characters on line number 2 and 3  where shifted 4 positions to the right.

Checking the source code I found that the line address are not correct.
Original:   int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
It should be:   int row_offsets[] = { 0x00, 0x40, 0x10, 0x50 };

I believe that the original code is for 2x16 or 4x20 lcd's hence the 0x14 and 0x54 addresses.

Perhaps one could add an extra parameter when creating the object
of the LiquidCrystal class stating the number of characters per line so it even works fine for all 8, 16 and 20 characters lcd's.

I even have a 2x40 lcd however did not test it yet.


gunric

I have also seen that problem. I thought it had something to do with the specifc LCD I have. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1246900100/10#10

tigoe

Can you post the specific model of LCD you're working with?  I found it worked on the models I have, but I wonder if you've got a non-standard Hitachi knockoff chip or something like that. Not sure if we can make it work for every exception, but it's worth looking into.

floresta

tigoe:

This issue has been covered in the three months that have elapsed since the last post to this thread.  Unfortunately I can't come up with the specific posts due to the limitations of the search function of this forum.  This is a known bug (actually an omission) in the LiquidCrystal library and the fixes have already been submitted for inclusion in an upcoming release.

Don

mellis

I'm not sure.  

There's a bug w/ the RW pin that causes it to get used when it shouldn't be.  That's known.

But the shifting of characters by two places on the third and fourth lines sounds like a different issue, one that I don't know the fix for.  If you have any more details, that would be great.

You might try searching with Google; it seems to do a good job of indexing the forum posts.

floresta

mellis:

The shifting or offset of characters on lines 3 and 4 of the 16x4 displays comes about because that display has different starting addresses for lines 3 and 4 than the 20x4 for which the library is written.

I found one of the previous threads about this topic using Google as you suggested.  Here's the link: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1253367247/6

Don

Go Up