How do I stack multiple PCF 8575C ?

16 Jun 2011

I have successfully built this circuit.

I now have 16 outputs. 16bit

How do I get 32 outputs. 32bit

Or 64 bits.

Apparently you can link up to 5 of these.

I have tried connecting 2 of these by linking pin1, with no luck.

/media/uploads/pinballer83/pcf8575_connections.gif

Thanks in advance.

16 Jun 2011

You need to tie the SDA and SCL lines to each PCF8575C and then set up unique address on each (A0, A1 & A2). You only need to tie pin 1, interrupt, to each if you are using that feature.

You should be able to link up to 8 of them to one I2C interface.

16 Jun 2011

to achive a possable 8 ofthese devics,the address pins meedto beat different logic levels,

A0 A1 A2

chip1 0 0 0

chip2 1 0 0

chip3 0 1 0

.. ..

chip5 1 0 1

chip6 0 1 1

chip7 1 1 1

hope this makes sens :)

Ceri

17 Jun 2011

Also you need to set the appropriate address in the i2c routines call. For your first device hardware address is 32 (dec)(A2=A1=A0=0) 0 1 0 0 A2 A1 A0 - format of slave address

17 Jun 2011

Thank you for all your help.

I understand the bit about tying the address lines. (Do I need to add more pull up resistors?)

I don't really understand how to set up a unique address for each chip. Are you referring to pin A0?

I am trying to control lamps and buttons on a pinball machine. I would like to do the following:

Using 4 PCF8575s I would like to use

1 PCF for 16 inputs. 3 PCFs for 3 x 16 outputs.

I used the code below successfully with 1 PCF8575

How do I modify the below code to work with 4 PCF8575s?

#include "mbed.h"
#include "PCF8575.h"

PCF8575 IO(p9, p10, 0x40);  // sda, scl, address
int var;

byte a;
                    // integer variable

int main() {
       while(1){
        IO.write(0xFFFF);   // All outputs goes high. 
        wait(1);
        IO.write(0x0000);   // All outputs go low
        wait(1);
        var = IO.read();    // Read the inputs on the PCF8575 to integer. 
}
}

Cheers David

18 Jun 2011

To set address for each chip, to pullup or pulldown the A0-A2 accordingly. In your schematic, the chip is set to address 0 as you tied all A0-2 to ground. Pullup on A1 on the second chip get will get you address 1 for it.