Search This Blog

Loading...

Thursday, September 23, 2010

Trick to get a 20x4 Optrex display working

Bought this display from Digikey for the Arduino.  It was the biggest and cheapest display I can find, and it is pretty cool.  20x4 display.


73-1249-NDLCD MOD CHAR 20X4 WHT TRANSFLECT017.72000



Previously I only used NewHaven Displays, and they all worked out of the box with the Arduino examples.

Optrex LCD worked very sporadically.  Every once in a while i'd see the correct text, but usually i got garbage on the display.  I ohmed out the board, and all was wired right.   I found a post that indicated that in 4 bit
mode the display waits between sending bytes, and the default code does not read the busy bits.  I thought maybe i needed to add some time between the nibbles in the library.

However it was much easier than that.  I wasn't sure how to recompile the library, etc, so i experimented with adding some delays in the sketch.   Turns out this big module just takes longer to boot up.

I added a delay like this:

lcd.begin(20,4);
delay(500);
lcd.print("hello, world!");

Ba Da Bing!  The display works now, every time.

No comments:

Post a Comment