Go Down

Topic: update to LiquidCrystal (Read 2241 times) previous topic - next topic


I re-wrote much of the LiquidCrystal library (for non-graphical LCDs like 16x2 line ones, etc)
it should now work much better for people and I'm looking to get it included in the next rev of the Arduino IDE and have it be the 'gold standard' for LCD interfacing

what has been added:
4-bit init. works even without power-cycling
correct timing delays reduce chance of 'garbling'
R/W pin not needed, saves 1 pin!
more commands to control the LCD display
you can set it up for 2 or 4 line displays with begin()
example for creating custom characters
much faster than old LiquidCrystal and LCD4Bit

please check it out, let me know how it works for you!


Awesome!  This is a very welcome update!


Nice! I did have to ground RW after disconnecting in order to get it working.

"way befer" Really? And I though that was a local thing...
Why do it right the first time, when building and rebuilding is  so much fun?


oh right yes you need to ground r/w
forgot to mention


Thanks for the update to the library. It's always nice to see new features added.



and I'm looking to get it included in the next rev of the Arduino IDE

I hope you have more luck than I did.  LiquidCrystal certainly needs some help.



here are some new tutorials as well!


Correct me if I'm wrong...

I'm seeing conflicting pin numbers on the page http://arduino.cc/en/Tutorial/LiquidCrystal

The wiring diagram image shows LCD pins D0-D4 in use, while the code below says:
"  * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2"

I used the old library with great success but in upgrading I'm getting some funky hieroglyphics -- I'm guessing that might be caused by the pin issues mentioned above as I've got flying leads from my 40x2 panel connected to D4-D7.  Out with the 'iron again I guess!   :-/



Looks like the wiring diagram has the data pins backwards- should be D0-D7 from left to right instead of D7-D0. The text has the correct information. Four bit mode always uses the top 4 data pins, D4-D7. If you've had it working before, the wires you have soldered to the LCD are fine.


Thanks for that beanoman, you saved me a lot of bother.

I had already tried wiring 'backwards' (D7-D4) to no avail.

More tinkering required.




I can not find an updated keywords file in the link. That could be nice.

I had to change the offsets in setCursor to { 0x00, 0x40, 0x10, 0x50 } to get the third and fourth line to start correctly but I guess that has something to do with my display (JHD164A).


Which datasheet are you using for the HD44780?  I was using this one from Adafruit:  http://www.ladyada.net/media/lcd/RT162.pdf  And this one from Sparkfun:  http://www.sparkfun.com/datasheets/LCD/GDM1602K-Extended.pdf  

Both of them show the pinouts as shown in the LiquidCrystal Tutorial.  I've tried that wiring with a half dozen different LCD's from different sources, and all worked properly for me. I also tried them on pins 0 - 4 according to those diagrams and got garbage.  So I'm perplexed as to why you've got different pinouts, or different documentation for it.  But if you've got a link to different docs on the module, I'm happy to try them out.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131