How to get 16 I/O and switchs
Ferris_Bue
Posts: 40
Ummmm,· I need a way to max out the #·of switchs and L.E.Ds. I need to have for every one switch a led. And I need a little help with it. All the I/O I've got is 16. And I would like a circuit to go with it. Any help that I can get I wuold like it.
Thanks,
Ferris
Post Edited (Ferris_Bue) : 11/5/2007 5:02:42 PM GMT
Thanks,
Ferris
Post Edited (Ferris_Bue) : 11/5/2007 5:02:42 PM GMT
Comments
If you're using a BS2p/pe/px Stamp or a Propeller, you could use some of the I2C I/O Expanders like the PCA9554 which can provide you with 8 I/O pins and you can attach up to 8 of these to a pair of I/O pins on the Stamp.
Ferris
Ferris
There are other chips out there for special uses that are more complex, more expensive, harder to use (all surface mount), etc. Someone mentioned a 32 bit high voltage serial shift register driver that's nice if you need to drive a vacuum fluorescent display, but is in a 48(?) pin surface mount package and probably more expensive than 4 easier to use chips like the 74HC595. There are 8 and 16 pin I2C I/O Expanders already mentioned in the Nuts and Volts articles that are hard (but possible) to use with a BS2 (easy to use with BS2p/pe/px because of the I2C commands).
If you're just curious, search yourself. Go through the Jameco catalog, find descriptions that sound interesting and search the web for datasheets. You can also go to the various manufacturer's websites and look through their on-line catalogs (start with Maxim/Dallas, Philips, TI). You'll learn a lot about what's out there.
You're not likely to find recommendations here for esoteric / rare / hard-to-use devices. Parallax markets primarily to hobbyists and the educational market. They want to provide / recommend parts that are easy to use and easy to explain, are cheap and reliable. If you want fancy, you'll have to do your own investigations.
Ferris
Polarity reversal can easily be done with a double pole, double throw relay or switch.
+
* * *
-
················|
··········· ·LOAD
··············· |
-
* * *
+
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 11/8/2007 5:39:36 PM GMT
Ferris
Exactly what behavior do you want from the LEDs and switches and how do you have them connected?
If they're not connected yet, the easiest way is to keep them mostly separate. The 74HC595 turns the
LEDs on and off and the 74HC165 detects the current switch settings. The Stamp essentially copies the
status of the switches as read from the 74HC165 to the 74HC595 to light the LEDs and you can modify
the information in the process of copying it.
Ferris
One way to drive a bi-color LED is to use a series resistor (always a series resistor) of around 330 ohms and connect the LED/resistor across two I/O pins (or two 74HC595 outputs). You make one output high and the other one low and one color lights. You reverse the high/low and the other LED color lights. If you change back and forth quickly so both LEDs light alternately, you get a blend of the two colors.
Post Edited (Mike Green) : 11/16/2007 4:34:51 PM GMT
Ferris
Post Edited (Ferris_Bue) : 11/16/2007 5:19:27 PM GMT
Always download a copy of the datasheet for any device you intend to use or are interested in. Part
of the question here is "what is the drive capability of the outputs?". Look on page 8 of the attached
datasheet that I downloaded by doing a websearch for "74HC595" (easy heh?) You'll see a table entry
for output current ... sink or source. All I need to know is that it's more than I need for most LEDs ...
at least 20-25mA ... and it is. Sink refers to the transistor that connects the output to ground and
source refers to the transistor that connects the output to +5V. So, it looks like it ought to work in
the kind of circuit I described where one output pin provides a ground connection for the LED and the
other output pin provides a +5V connection for the other end of the LED.
Are there other chips out there that work better? I don't know ... It depends on what you mean by
better and on what you want to do in the end.
Some people want the cheapest chip. Some people want a chip that looks easy to program. Some
people want a really small chip. Some people have power limitations and want a micro-power chip.
What do you want?