DIP switches, serial devices
Archiver
Posts: 46,084
Bob-
Perhaps you considered and rejected this already, but you don't need
48 switches to perform a 1-of-40 selection. With 6 switches, you
have 64 possible settings. That may or may not bring the number of
switches down low enough to hang them directly off of Stamp pins, but
it ought to lower the shift register or whatever count.
Regards,
Steve
On 3 Apr 01 at 13:56, Bob Pence wrote:
> Is there an IC analogous to an Analog to Digiatal Converter that can
> be used to read DIP switches via a serial connection, synch or
> asynch? I am looking to use 4 banks of 12 DIP switches so that the
> end user will have some control over process variables (e.g. do
> something for 5, 10, 15, 20, 30, or 40 seconds)...
Perhaps you considered and rejected this already, but you don't need
48 switches to perform a 1-of-40 selection. With 6 switches, you
have 64 possible settings. That may or may not bring the number of
switches down low enough to hang them directly off of Stamp pins, but
it ought to lower the shift register or whatever count.
Regards,
Steve
On 3 Apr 01 at 13:56, Bob Pence wrote:
> Is there an IC analogous to an Analog to Digiatal Converter that can
> be used to read DIP switches via a serial connection, synch or
> asynch? I am looking to use 4 banks of 12 DIP switches so that the
> end user will have some control over process variables (e.g. do
> something for 5, 10, 15, 20, 30, or 40 seconds)...
Comments
be used to read DIP switches via a serial connection, synch or
asynch? I am looking to use 4 banks of 12 DIP switches so that the
end user will have some control over process variables (e.g. do
something for 5, 10, 15, 20, 30, or 40 seconds). Dedicating an I/O
pin to each DIP switch is out of the question. I've thought about
using an ADC and ignoring the least significant couple of bits, but
this seems to be the wrong path.
Regards
Bob Pence
This is a perfect place to use the "one pin, many switches" app note in the
Stamp manual. The idea is to make a switch-controlled potentiometer and then
use RCTime to read the current resistance (along with a known capacitor).
You'd have to make sure that each combo results in a unique resistance you
could differentiate, but I'm sure you could come up with something
(especially if you dedicate a pin per bank).
For example, consider 3 dip switches. Put a 220 resistor and a .1uF cap.
Then put 3 resistors in series (1K, 2K, 4K) so that when the switch is
closed, the corresponding resistor is shorted out (0 ohms). Now:
000 - 7220
001 - 3220
010 - 5220
011 - 1220
100 - 6220
101 - 2220
110 - 4220
111 - 220
An RCTime could easily differentiate between these.
You could also use a shift register (actually, more than one).
Regards,
Al Williams
AWC
* NEW: PAK-IX adds floating point math and A/D! Coming soon:
http://www.al-williams.com/awce
>
Original Message
> From: Bob Pence [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=WMcBsEO3zwoU8pAeD7_9hBPE3pZV9i0JhekeS2O4MdeuL5RyyvcCj8ypvsmRqZrOqAxq4nqx8Zixkx_7dEbhyRJ5]bobpence_2000@y...[/url
> Sent: Tuesday, April 03, 2001 8:56 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] DIP switches, serial devices
>
>
> Is there an IC analogous to an Analog to Digiatal Converter that can
> be used to read DIP switches via a serial connection, synch or
> asynch? I am looking to use 4 banks of 12 DIP switches so that the
> end user will have some control over process variables (e.g. do
> something for 5, 10, 15, 20, 30, or 40 seconds). Dedicating an I/O
> pin to each DIP switch is out of the question. I've thought about
> using an ADC and ignoring the least significant couple of bits, but
> this seems to be the wrong path.
>
> Regards
>
> Bob Pence
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
the resistance. Then use RCTIME to get the resistance. There was a good
example of this in the Robot Builders Bonanza.
Original Message
> Is there an IC analogous to an Analog to Digiatal Converter that can
> be used to read DIP switches via a serial connection, synch or
> asynch? I am looking to use 4 banks of 12 DIP switches so that the
> end user will have some control over process variables (e.g. do
> something for 5, 10, 15, 20, 30, or 40 seconds). Dedicating an I/O
> pin to each DIP switch is out of the question. I've thought about
> using an ADC and ignoring the least significant couple of bits, but
> this seems to be the wrong path.
>be used to read DIP switches via a serial connection, synch or
>asynch? I am looking to use 4 banks of 12 DIP switches so that the
>end user will have some control over process variables (e.g. do
>something for 5, 10, 15, 20, 30, or 40 seconds). Dedicating an I/O
>pin to each DIP switch is out of the question. I've thought about
>using an ADC and ignoring the least significant couple of bits, but
>this seems to be the wrong path.
>
>Regards
>
>Bob Pence
Hi Bob,
This is a good application for a shift register:
http://www.fairchildsemi.com/pf/MM/MM74HC165.html
You would need 5 of them to handle the 48 switches, and 5 resistor
networks for pullups, and maybe capacitors for de-bouncing. The 5
shift registers can be chained together, so that you only need 3
stamp pins for the interface, and 3 SHIFTIN commands.
Another approach would be an 8x8 matrix, with a 74hc164 or a 74hc595
for the output rows, and a 74hc165 for the input columns, scanning in
software.
I would not recommend the RCtime solution for that many switches.
The CPU processing needed for de-bouncing the switches is pretty
demanding. You have to assure you have captured a good value, as
opposed to a reading in transition.
-- regards,
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
> The CPU processing needed for de-bouncing the switches is pretty
> demanding. You have to assure you have captured a good value, as
> opposed to a reading in transition.
>
Hi Tracy,
This is a good point, but if the DIP switches are like most DIP switches,
they are set once before power up and then never changed again. In that
case, I don't think the RC solution is that bad. You are right though -- if
the switches change on the fly, that might not be a good idea.
Al Williams
AWC
*NEW: PAK-IX Floating point A/D converter...
http://www.al-williams.com/awce/pak9.htm
cascade them to each other for more positions than 1 alone.
norm
>From: Tracy Allen <tracy@e...>
>Reply-To: basicstamps@yahoogroups.com
>To: basicstamps@yahoogroups.com
>Subject: Re: [noparse][[/noparse]basicstamps] DIP switches, serial devices
>Date: Tue, 03 Apr 2001 10:03:05 -0700
>
> >Is there an IC analogous to an Analog to Digiatal Converter that can
> >be used to read DIP switches via a serial connection, synch or
> >asynch? I am looking to use 4 banks of 12 DIP switches so that the
> >end user will have some control over process variables (e.g. do
> >something for 5, 10, 15, 20, 30, or 40 seconds). Dedicating an I/O
> >pin to each DIP switch is out of the question. I've thought about
> >using an ADC and ignoring the least significant couple of bits, but
> >this seems to be the wrong path.
> >
> >Regards
> >
> >Bob Pence
>
>Hi Bob,
>
>This is a good application for a shift register:
> http://www.fairchildsemi.com/pf/MM/MM74HC165.html
>You would need 5 of them to handle the 48 switches, and 5 resistor
>networks for pullups, and maybe capacitors for de-bouncing. The 5
>shift registers can be chained together, so that you only need 3
>stamp pins for the interface, and 3 SHIFTIN commands.
>
>Another approach would be an 8x8 matrix, with a 74hc164 or a 74hc595
>for the output rows, and a 74hc165 for the input columns, scanning in
>software.
>
>I would not recommend the RCtime solution for that many switches.
>The CPU processing needed for de-bouncing the switches is pretty
>demanding. You have to assure you have captured a good value, as
>opposed to a reading in transition.
>
> -- regards,
> Tracy Allen
> electronically monitored ecosystems
> http://www.emesystems.com
>
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com