PCF8575 with LCD

Hi,
Has anyone been successful in getting a PCF8575(NOT PCF8574) port expander to work with a 2004 LCD?
I have tried multiple things, including trying to mod the code/libraries for the PCF8574(8 bit) and also for the PCA9555, which is also a 16 bit IO expander.

I've searched the internet high and low for solutions.

The 8575 is a 16 bit IO expander as opposed to the 8574 being a 8 bit IO expander.

Please help me with this, it is driving me mad.

From looking at the datasheet it seems to work very similar to the 8574 other than having 2 eight bit ports and the master must send/receive 2 bytes a time vs 1.
So if you know how to control an LCD with a PCF8574 then this will not be much different.

But having written several Arduino hd44780 LCD libraries that used PCF8574 and MCP23008, it looks like using the PCF8575 will not be faster updating the LCD display than using a PCF8574 given that 2 bytes must always be sent to chip.

On a larger note, why use the 8575 vs the 8574 since PCF8574 lcd backpacks are about $1 USD shipped to your door?

If it is to use the extra pins for something else other than the LCD, that will be tougher modification as the extra bits in the port register now have to shared with some other code/library.

--- bill

Hi Bill,

Thanks for your reply.

I know it sounds simple to some, but I'm really new at this.

The reason I want to use the 8575 is that I already have these chips on boards that have the LCD header on them. They are already in use as LCD i2C boards, so I have access to more if I can get this one working. Also, I think the extra 8 IOs would be handy.

Regards,
Luke

I'm betting that you will likely not find a ready written library. The reason being that the PCF8574 backpacks are so cheap and libraries for those are readily available so there isn't much incentive to write something for the 8575.

The easiest solution will likely be to modify an existing PCF8574 library.
Note: Writing a full hd44780 library over i2c from scratch is not a small task that requires quite a bit of knowledge, which is why I say it will be easier to start with some existing working code for a 8574 since the 8574 is very similar to the 8575.

To get it working the first thing you will have to do is map out how it is wired up to the LCD.
How is each 8575 output port pin wired up to the HD4480 pins.
This will determine the modifications that will need to be made to existing library.
You will have to determine if the hd44780 pins are all on a single port or spread across both ports.
You will then have to modify the "send" function to push out the 8574 bytes to pins on the ports for your board.
It isn't that difficult but will require that you fully understand how the pins from the 8575 are wired to the hd44780 pins and how to make those pins talk to the LCD.

You could look at using my hd44780 library package. It is designed to be extensible for any type of interface that talks to an hd44780 display.
It is uses layers. The hd44780 functionality and user API handled by separate class which allows an i/o class to be really simple since the i/o class only has to handle getting the hd44780 command or data byte to the device.
The hd44780 library package is available in the IDE library manager and you read more about here:

You could look at the hd44780_I2Cexp class for an example, but it is probably a bit overkill since it does lots of auto configuration and supports MCP23008 as well.
The hd44780_I2Clcd might be better to look at as it is a much simpler i/o class that is very basic and interfaces to the hd44780 class in a similar way as to what you will need to do.
For you own i/o class you you must define at least these two functions:

  • ioinit()
  • iowrite()

to talk to your device.
Although you will probably want to look at the iowrite() function in the hd44780_I2Cexp class to see something closer to what you will need to do for your board.

These other functions may or may not apply:

  • ioread() - if you want to read from the display
  • iosetBacklight() - if you have on/off backlight control
  • iosetContrast() - if you have some sort of contrast control

-- bill

Hi,

Thanks Bill, you've given me some good ideas.
I realize now what I've gotten myself into lol.

i'll give those libraries a bash, see if I can come right, if not then I'll just source myself some 8574 chips, as I see that is a pretty standard IO expander that people are using to implement i2c LCDs.

Sounds like what I'm trying to do is better suited to advanced Arduino programmers!

I'll repost if I come right, thanks for your help!

Cheers,
Luke