TextLCD library supporting various panel sizes

29 May 2010

We had a long thread a while back where we were trying to uncover the different ways Text LCD panels are driven by the 4-bit HD4478 driver, and i've seen various people getting 2x16, 4x20, 2x20 panels working since.

As a bit of a test of how to make it "just work" for different panels, i've just published a version of the TextLCD driver that allows you to specify the panel configuration as an enum, letting us add support for different panel sizes and addressing modes. It also ignores the rw pin, as that can be tied to 0v as it is unused.

I've put up a page on the new cookbook which links to the library:

Currently I included 16x2, 20x2, 20x4 and an alternate 16x2B mode. I'm interested in anyone who has a display that uses the HD4478 could:

  • Test the code with their display to see if it works, setting the appropriate panel size, and report back with your display details and results
  • Identify any displays that you have that are not 16x2, 20x2, 20x4 or that don't work with this library

Please report back! Assuming this works, we can try the same approach for e.g. the Nokia displays with different Epson vs Philips drivers etc.

Thanks,

Simon

07 Aug 2010 . Edited: 07 Aug 2010

I feel a bit anxious about breaking the deafening silence, but you did ask for feedback.

The default setting worked for the first 2x16 display I tried  which has a part number of "Truly MCC162A4-5".

I'll try a couple of other 2x16s today.

One minor puzzle - the pin assigments you use in the code don't seem to match those in the picture of the breadboarded LCD and mbed. I guess that might confuse a beginner.

I'm working on a library that uses an I2C port extender to drive the LCD. It looks as if the only difference will be in the writeCommand, writeData and writeByte methods, so I'll probably fork your TextLCD class and introduce a base class from with the direct drive and I2C driven classed can inherit.

I'm really enjoying working with the mbed, btw. Thanks for creating a great platform.