New liquidCrystal Arduino Library
A new, 100% compatible with the current liquiCrystal Arduino library is available from: https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home.
With the same interface, the new library supports:
- 4 bit parallel LCD interface
- 8 bit parallel LCD interface
- I2C IO bus expansion board with the PCF8574* I2C IO expander ASIC.
- ShiftRegister adaptor board as described Shift Register project home.
In addition, it is faster than the existing liquidCrystal included in Arduino. In 4-bit mode (which is sort the “standard” mode), the new library performs operations an average of 3.73 times for a write operation. There is really no need for the current Hifiduino code to have faster LCD operations, but the performance increase is “free”.
SUPPORTS SERIAL INTERFACE
Further (and without any change in the code), you can purchase/build an I2C adapter for the LCD and free up 9 pins in the Arduino to do other things. The I2C adapter is explained here: [link]
The nice thing about the library (if we set a side its speed improvements) is that its been written as a virtual class that can be extended to accommodate multiple ways to drive an LCD with the Hitachi chipset or compatible. The only thing that you need to do to include a fully compatible new driver (for example an SPI buffer) is to implement how to write to the buffer and the function to initialise the LCD using that device. All the support functions in the LiquidCrystal library are there and compatible.
The other nice thing, is that if you already have a project that uses a particular LCD driver (say 4 bits) and you now want to change it to I2C the only thing that would change in your code would be the way you create the “variable” to control the LCD. The rest is the same.
This is a bit different approach with respect to the huge collection of libraries that control LCDs and do more or less the same thing.
So with one library, you can control LCDs that use different devices or ways to control them, for example: 4bit, 8bit, I2C, shiftregister (2 and 3 wires) and shortly with just 1 wire.
TESTED WITH HIFIDUINO CODE
After downloading the libraries (LiquidCrystal_V1.1.6.zip), I replaced the folder arduino-1.0\libraries\LiquidCrystal with the new LiquidCryistal folder (save the original folder somewhere else). Compiling the existing code resulted in no errors. It also runs as before.
There is no apparent differences in the way the text is displayed. Even thought the write operation to the LCD is faster, the refresh rate of the LCD is the limiting factor, so the display “feels” exactly the same. The only difference is in the “DIM” function: returning from DIM to the current volume setting is about 20% faster. For example if your volume is set at 00 and you DIM the volume (-70 db), it takes 4 seconds to return to 00 volume whereas the code with the original library took 5 seconds.
CONTRIBUTION FROM SPAIN’S ARDUINO ENTHUSIASTS
(The vinciDuino Logo was done by Inizul from the Spanish Arduino forum the creator of the paperDuino. The idea behind the logo was to simulate Leonardo Da Vinci’s habit of writing. In addition, it reads the same rotated 180 degress)
Be sure to check the project’s home page to see what is new…