View Full Version : I/O Expander for BS2
01-17-2007, 12:56 PM
Still trying to figure out things· and· need some advice for expanding I/O· capability of BS2 (came with discovery Kit). I tried to get answer from old post but still had some confusion and apologize if this has been answered before.
Question: How to expand I/O· capability of BS2 ?
Option1: Use MCP23016
Option2: Use PCF8575 (Breakout Board available at (http://www.sparkfun.com/commerce/product_info.php?products_id=8130)
1. Which option is better / simpler ? (I am still in breadboard stage so need some thing that is not too complex from·connection perspective)
2.·Seems we need I2C for PCF8575 but looks like BS2 does not support I2C, can I use PCF8575 with BS2 using SHIFTIN / SHIFTOUT ?
3. BTW, what is the difference between I2CIN· and SHIFTIN ?
Thanks for your valuable advice.
01-17-2007, 01:42 PM
I have the same problem (not enough i/o ports). Use the stamp 2p40, same as stamp ii , but much more i/o pins.
01-17-2007, 01:53 PM
1) Depends on what you want to do. There's an improved version of the MCP23016 (the MCP23017 - much easier to use).
The PCF8575 is simpler to use, but has limited drive for high (source) signals, but decent low (sink) level drive.
2) There are some coding examples of doing I2C using a BS2 on the Parallax website. Look particularly at the Nuts and Volts archives.
3) I2CIN does input using the particular protocol for I2C. SHIFTIN does input for a clocked serial protocol (like SPI)
There are other options. For output expansion, use a 74HC595 (see Parallax's datasheet) with the SHIFTOUT statement. There's also a part from Texas Instruments ... TPIC6595 which combines a shift register compatible with the 74HC595 with MOSFET high current drivers, all on the same chip. For input, you can use the 74HC165 which can provide 8 bits of input usable with the SHIFTIN statement. There are other, more complicated, ways to expand the input/output capability of the Stamps, but this is enough to get started.
01-17-2007, 02:31 PM
Q1: I guess we need to know how many more I/O lines you need to evaluate better/simpler?
If it's only a few more, then maybe you can have your Stamp output multi-bit codes which an external de-mulitplexing circuit decodes into a larger number of control signals. By way of example, you could feed 4-bit data (binary 0000 through 1111, 16 discrete values) to a 74154 (a 4-to-16 line multiplexer) which would allow 4 Stamp I/O pins to control 16 outputs. This leaves you 12 I/O pins for whatever combination of inputs and outputs that you need for the rest of your design. Total I/O: 28 lines (16 output only, 12 mixed I/O).
(After reading the device's description and it's datasheet...) The PCF8575 is superior to this arrangement since it provides 16 bi-directional I/O lines at a cost of only 2 Stamp I/O pins (the true cost is the programming effort; trade hardware for software). And, since I2C allows multiple devices to share the same bus, you can control up to 8 of these devices (each '8575 is assigned a 3-bit address via address pins which gives you devices 0 through 7, 8 in total) which gives you up to 128 I/O lines. The mind boggles.
Q2. Mike's got this one answered...
Q3. I had an answer but the Nuts and Volts article #85 says it much better... http://forums.parallax.com/images/smilies/tongue.gif
I wouldn't connect that if I were you...
Vive Le Tour!
Le Grand Depart July 6-8, 2007
Post Edited (aalegado) : 1/17/2007 7:57:51 AM GMT
01-17-2007, 07:23 PM
Actually, I would use MCP23017 instead of 23016.· Why?· No external cap. needed.·
It is I2C and gives 16 I/Os.· It operates similar (though not identical) to 23016.
01-17-2007, 11:52 PM
Thank you very much for your good advice, it definitely clears my confusion.
I am not sure how many i/o pins I will need as my project is still evolving and I am new to this so I am taking one step at a time.
I am inclined to use MCP23017 but wondering how to put it on breadboard ?·Is there an IC socket for putting this on breadboard ??
Thanks again, I appreciate your valuable help.
01-18-2007, 07:58 PM
MCP23017 comes in DIP version.· So you can just insert it into the breadboard without any special tools.· That's what I've done in the past.·