Wednesday, August 3, 2016

An AVR Atmega library for multiple HD44780 based LCD connected through i2c



This library implements a driver for HD44780 lcd connected through PCF8574 port expander.
Data is transmitted using only 2 wire over i2c with the PCF8574.
This library can drive up to 8 LCD concurrently.


Lcd driver is based upon Peter Fleury's lcd driver
HD44780 to i2c library its based upon this library: http://davidegironi.blogspot.it/2013/06/an-avr-atmega-library-for-hd44780-based.html

Each PCF8574 needs to have a different address selected, this can be done by the A0,A1 and A2 pins.


Setup parameters can be found in file lcdpcf8574.h and pcf8574.h
This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 8MHz.


Code
Notes
  • read risk disclaimer
  • excuse my bad english

12 comments:

  1. You can double that up to 16 by allowing for both pcf8574 and pcf8574A chips. They are identical except for their base address so you can have 8 of each on a single i2c bus. I did this same thing 10 years ago by modding Peter Fleury's LCD library with his i2c library.

    ReplyDelete
  2. i am complete new in avr i was programming in arduino.....can you please help me how to use this library.

    ReplyDelete
    Replies
    1. Hello, i suggest you to start at small step. The first one could be blinking a led with plain avrgcc. You will find many tutorial online.

      Delete
  3. I see you are using p0-p3 as your data pins. And p4-p6 as your conrol pins for the 1602 LCD.

    Inexpensive 1602 LCD and pcf8574T I2C boards on Ebay are using p4-p7 as data pins and p0-p2 as control pns for the LCD.

    Do you have anything written for the 2nd configuration?

    ReplyDelete
    Replies
    1. Hello, you just can remap the configuration file for your device.

      Delete
    2. hello,
      i just tried to remap the data (p4-p7) pins in your h file, but i can't seem to get it to work...can you get more specific where the adjustments have to be made and how? any help would be greatly appreciated!

      Delete
    3. Nevermind, got it. Made an error when I did the multimeter routing. Works like a charm, thank you!

      Delete
    4. Hello Tommi, that's great! Happy to hear this!

      Delete
  4. could this be reconfigured to work with atmega328p?

    ReplyDelete