I/O Expansion Via I2C

Custom PCB Boards Getting Started Tips Timing Pulse Generation 3rd Party Hardware Object Exchange 3rd Party or Forum Software FAQ Programming Examples

 

bullet

If you need more input/output pins than the 32 that the Propeller gives you, you can use the existing I2C bus (Pins# 28 & 29) to interface with I/O expansion chips. 

bullet

This gives you more pins without using up ANY that weren't already in use.

bullet

Also, by using an I2C "Level Shifter" you can use the I/O pins with other voltages, e.g., 5V.

bullet

I/O Expanders:

bullet
The PCF8574 is a simple 8 I/O port device (comes in 16 Pin DIP).  This chip has been around a long time...
bullet
I'd recommend using the PCA9554 (below) instead.
bullet
I've made a minimal I2C driver (based in Mike Green's i2c driver in Object Exchange).   Here's a screenshot: 
bullet
Download the code here
bullet
 Vdd from 2.5 to 6 VDC, 100kHz I2C, can sink 25 mA per pin but only 100 mA total, source 0.1 mA per pin, 5 V tolerant I/O.  Two pins may be tied together to sink 50-mA.
bullet
The PCA9554 is basically an improved version of the PCF8574 and has the exact same pinout.  But, the control commands are a bit different...
bullet
It offers individual pin I/O directions and polarities.
bullet
I've modified my PCF8574 code for the PCA9554
bullet
The MAX6956 is a 20/28 I/O port device (comes in 28 Pin DIP) and has a driver in the Object Exchange.
bullet
The MCP23016 is a 16 port I/O expander (also comes in 28 PIN DIP) and has a driver in Object Exchange.
bullet
Phillips offers a wide range of I/O Expanders (discussed in this AppNote)
bullet

I2C Bus Expanders / Level Shifters

For level shifting to 5V, I haven't found anything in a DIP package.  Best is an 8-pin SO8 package.
bullet
I've used the PCA9512A (gives hot-swap ability) and the PCA9509 (easy pin arrangement)
bullet
Here's some pictures of how I put 3 PCF8574 (running at 5 VDC) in a separate box from the Prop, with a 2-ft cable carrying the I2C signals (note that a 6-ft cable didn't work, would need to add an i2c extender in the prop box to make that work). 
bullet