Using PCF8575 i2c I/O port expander

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? See page 2.

Any ideas or code examples from others who have done this? THANKS!

You're either going to write 16 bits, or read 16 bits of data

See page 6 for details Basically, set your 16 bits (top8 all 1's... P0) and your LED's

THEN read from the same 16 bits and slice out the top 8 bits of data for your imputs

Doesn't look like you can just do half the work

Well, I want the LED's to respond to the switches. So if i press switch 0 located on P00, LED 0 on P10 turns on. When i release switch 0, LED 0 turns off. The way i see it, if i have to write to all 16 pins, i could potentially be writing a 0 (low voltage) to pin that goes to Vcc through one of the switches (which is being pressed) and short the power source. That doesnt seem right!