New LiquidCrystal library - LCD library

bperrybap:
tack,
Cool. Yep on i2c, and the SR interfaces the constructor values are all output bit numbers.
Makes sense if you think about it.
Glad it worked. Your i2c board matches mjkdz i2c board that I have.

When using the newer constructors that specify the backlight pin/bit and backlight polarity, there is no need for
the setBacklightPin(). The constructor sets up everything.

Yes, it does make perfect sense now. It was just frustrating trying to work it out. LOL.

As for the SR vs I2C issue, the cheapest I've managed to find 8674 SMD is about $0.65, wheras a 100 595N cost me $12.00 or $0.12 each. To me, in the UK, that works out about 40p cheaper per board. I also need fewer headers (for my flexible setting address, backlight via I2C/Pin(PWM) and Contrast via Trimmer/Pin(PWM). That all adds up to maybe more than halve the build cost against using 8574 for I2C.

fm:
If you look in the project's wiki you will see that the 2 wire SR version of the library is about 4,5 times faster than the stock parallel LiquidCrystal an almos 40 times faster than the I2C versio.

Wow, that's some difference. I actually expected it to be slower for some reason. No real basis for that though, other than I guess some intuition that a cheaper method using generic SR would be slower than a specific implementation like I2C, or a parallel interface using a lot more pins.

I'll definitely give that a try at some point as I have plenty of 595N's coming. I think I'll be off to design a new 2W SR based backpack. :wink:

I guess the only difference is with controlling multiple LCD's. With 2W SR would I need another 2 pins for a an LCD displaying different data?

How does the library handle daisy chained SR? Does it, or would it be possible, to support multiple LCD's by writing 16, 24, 32 bits across multiple SR to display the same or different data on each? I'm thinking of this from the way ShiftPWM works. If you actually have 2 SR connected, but specify only 1 then the data gets repeated on the second.

Maybe the SR constructor could include a NUM_SR data to effectively specify how many LCD's. I suppose you'd need some kind of reference to each one for lcd.write() etc, such as lcd1.write, lcd2.write like you would if declaring multiple constructors normally.