Marc's Public Blog - Arduino Hacking


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Computers | Diving | Dreamstate | Edc | Electronics | Exercising | Festivals | Flying | Halloween | Hbot | Hiking | Linux | Linuxha | Monuments | Museums | Oshkosh | Outings | Public | Rc | Sciencemuseums | Solar | Tfsf | Trips



>>> Back to post index <<<

2012/01/23 LiquidCrystal driver support LCD3Wire hardware (pebble and others)
π 2012-01-23 01:01 in Arduino
TL;DR: Get code here.

All the code is arduino 1.0 compatible

After coming back from the Arduino Miniconf at Linux.conf.au, I ended up with a freshly soldered freetronics pebble v2.

Like the Pebble V1 (schematics here), it uses MC14094 8 bit shift register to drive the LCD using only 3 wires instead of 6 or more.

The Pebble designers thankfully used the same shift register wiring than shown on the LCD3wire page on arduino playground. However, the code that came with it only had limited functionality for talking to the LCD, and the code on the LCD3wires page is also limited in functionality (on top of being incompatible with arduino 1.0).

So, I ended up finding Francisco Malpartida's cool work on virtualizing the stock arduino LiquidCrystal library (very featureful and optimized timings). In turn, Ragnar used that codebase to design his own shift register library for 2 or 3 wires.

Ragnar's wiring and code is somewhat complex because it exploits some interesting hacks:

  • it is designed to work with cheaper non latching shift registers.
  • it can be made to work with just 2 wires instead of 3 for non latching shift registers.
  • because of the design, the code is less obvious and exploits some tricks, but it sure works :)
  • his code can work for latching shift registers, but I do not recommend using the more complicated wiring and code if you can afford 3 wires and a shift register. Just use the LCD3Wires wiring and the code from this page.
  • In other words, if you have a non latching shift register, use his code and wiring. If you have a latching shift register, you should use the code from this page and the more widespread LCD3Wires wiring.

    So, where does this bring us?
    I used Malpartida and Ragnar's work to make an LCD3Wire hardware driver for the NewLiquidCrystal Library. This brings full library support to the pebbles as well as other folks who use the reference wiring from LCD3wires.

    I called the new library NewLiquidCrystal in the hopes that it will become the new de facto library in standard arduino one day. My code is here: https://github.com/marcmerlin/NewLiquidCrystal and includes the new LiquidCrystal_SR_LCD3 driver I wrote. To be clear, all the code came from Francisco Malpartida's work, I built on top of it to write my LiquidCrystal_SR_LCD3.cpp driver for LCD3Wires compatible hardware.

    I also wrote an extended LiquidCrystal Demo which should work on all liquidcrystal supported devices (baring the character count).



    Here is a demo of my popup menu code that works with a rotary button (cursor showing what is currently selected if you click on it)


    I'm now working with Francisco to get my code included in his tree, and if we're lucky that code may eventually get included in the standard arduino libraries as a faster and more flexible LiquidCrystal replacement.


    More pages: November 2024 June 2024 August 2023 June 2023 May 2023 April 2023 March 2022 January 2022 January 2021 December 2020 March 2020 January 2020 May 2019 April 2019 March 2019 January 2019 July 2018 May 2018 April 2018 January 2018 June 2017 April 2017 January 2017 February 2016 January 2015 September 2013 January 2012 December 2011 May 2011 January 2011

    >>> Back to post index <<<

    Contact Email