Shop OBEX P1 Docs P2 Docs Learn Events
How to get 16 I/O and switchs — Parallax Forums

How to get 16 I/O and switchs

Ferris_BueFerris_Bue Posts: 40
edited 2007-11-16 17:30 in Learn with BlocklyProp
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-05 16:53
    There are plenty of examples in the StampWorks manual and several Nuts and Volts columns on expanding I/O on the Stamps, usually using something like the 74HC595 serial output shift register or the 74HC165 serial input shift register. These can be cascaded (connected one to the other) and each one gives you 8 outputs or 8 inputs respectively. For driving LEDs, you have to be careful about the maximum amount of current for any one device. There's a TI version of the 74HC595 that incorporates high current drivers called the TPIC6595 that you could use if needed.

    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_BueFerris_Bue Posts: 40
    edited 2007-11-07 16:06
    Is there another chip out there that can expand the I/O of a BS2?

    Ferris
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-07 16:22
    There are several Nuts and Volts columns that discuss this and give you examples of chips. Try #79, #85, and #109.
  • Ferris_BueFerris_Bue Posts: 40
    edited 2007-11-07 16:43
    Ummm, I was wanting so other chip other than what parallax has said.

    Ferris
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-07 17:09
    Why?

    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_BueFerris_Bue Posts: 40
    edited 2007-11-08 16:45
    Now I need a way to change the polarty of the led with the swich. Can any1 help?

    Ferris
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-11-08 17:34
    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_BueFerris_Bue Posts: 40
    edited 2007-11-09 16:22
    now how do I get the 74HC165 and the 74HC595 to work to geter?

    Ferris
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-09 16:43
    Back to basics ...

    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_BueFerris_Bue Posts: 40
    edited 2007-11-16 16:22
    Ummm, with all that how do I chang the politery of an led with out blowing the bs2 up?

    Ferris
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-16 16:27
    There are lots of ways ... What are you trying to do? Do you have two color LEDs? Have you tried anything already?

    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_BueFerris_Bue Posts: 40
    edited 2007-11-16 17:01
    If I do use the 74HC595 would I need to use another chip with it? And are there any other chips out there that work better?

    Ferris

    Post Edited (Ferris_Bue) : 11/16/2007 5:19:27 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-16 17:30
    You need to start learning how to read a datasheet so you can answer this sort of question yourself.
    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?
Sign In or Register to comment.