I2C is a communication bus that uses 4 wires, +5V and GND, and SDA (serial Data) and SCL (Serial Clock). The latter two are specific for I2C.
Multiple devices can be connected to an I2C bus. Every device has its own address (like a street with houses). To communicate with the right device you call its “housenumber” over the bus so the device knows the next commands are his/hers (are I2C devices male or female?) .
On page 5 of the spec of PCF8577C.pdf paragraph 6.1 there is some talk about addressing. By connecting these pinsd to GND or +5V you can set the address of the chip.
The chip contains registers that represent the IO pins.
Fig 8 on page 8 shows how to control them:
1st send a byte with the address, (fig 6 page 8)
2nd send a control byte (fig 3 page 6)
3rd send byte(s) to fill the registers (table 1 and 2 page 9)
Note Table 1 shows both the control byte and the registers
First try to fill the first register to see what happens. Connect leds to pins S1…S8 (with approp resistor) and send the following 3 bytes
<00000000><01010101> (bytes in binary format)
half the leds should glow,
sending
<00000000><10101010>
should make the other half glow
Now attach more leds (all 32 pins) and try to set all registers.
<00000000><10101010>
<00000010><10101010>
<00000100><10101010>
<00000110><10101010>
If this works you have made big progress.
The last 4 commands can be combined into one by sending multiple bytes in one command
<00000000><10101010><10101010><10101010><10101010> To understand how this works read paragraph 6.4
Hopes this gets you started. Read chapter 6 carefully as it is the core explanation. Succes,
Rob