Im familiar with the i2c protocol and have been trying to adapt it to the arduino Wire library. I have found many examples on how to read or write to the device via the i2c bus, however, i cannot figure out how to read AND write. The PCF8575 has 16 I/O pins. I have 8 switches and 8 LED's. I want to read from the 8 switches (on P0-P7) and write to the 8 LEDS (on P10-P17).
The datasheet says that the data transfer needs to take place in byte pairs where byte 1 relates to port 0 (P0-P7) and byte 2 relates to port 1 (P10-P17). If this is the case, how does one read from only P0-P7 and write to only P10-P17? http://focus.ti.com/lit/ds/symlink/pcf8575c.pdf See page 2.
Any ideas or code examples from others who have done this? THANKS!