20 switch positions to fewest input lines
Archiver
Posts: 46,084
At 09:42 PM 12/15/02 +0000, you wrote:
>Hi all,
>
>I need to connect something like a rotary switch (preferr a pot) to
>a Stamp and want to use a minimal number of pins.
>
>I have 20 seperare conditions. all fed from one device.
>
>Actually, I would like to use a pot to a chip and have that chip then
>signal the stamp.
>
>speed is the problem, the input must be on the pins and not serial as
>the serial takes too long.
>
>The pot is preferred only as a pot is cheap and a 20 posistion switch
>is expensive.
>
>any suggestions ?
>
>Dave
>
>Dave -
Take a look at App Note 18 in the Basic Stamp I Applications Manual. If you
don't have on, contact me off list, and I'll send it to you. It can be
adapted to the Basic Stamp II. This uses ONE PIN for nearly as many switches
as you may want.
Regards,
Bruce Bates
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the Subject and
>Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>Hi all,
>
>I need to connect something like a rotary switch (preferr a pot) to
>a Stamp and want to use a minimal number of pins.
>
>I have 20 seperare conditions. all fed from one device.
>
>Actually, I would like to use a pot to a chip and have that chip then
>signal the stamp.
>
>speed is the problem, the input must be on the pins and not serial as
>the serial takes too long.
>
>The pot is preferred only as a pot is cheap and a 20 posistion switch
>is expensive.
>
>any suggestions ?
>
>Dave
>
>Dave -
Take a look at App Note 18 in the Basic Stamp I Applications Manual. If you
don't have on, contact me off list, and I'll send it to you. It can be
adapted to the Basic Stamp II. This uses ONE PIN for nearly as many switches
as you may want.
Regards,
Bruce Bates
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the Subject and
>Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Comments
[noparse][[/noparse]Non-text portions of this message have been removed]
the -one pin many switches- uses the pot command to determine the
state. and this takes several miliseconds.
The changing of a switch during the loop can cause a mis-read. not
really important, as a change is make very infrequently, so the next
pass would see the correct state.
the loop in question is only about 10 lines long so any delay that
extends that will severly change the speed. 6 of those lines are
dedicated to looking at the state of 6 pins.
Dave
--- In basicstamps@yahoogroups.com, Bruce Bates <bvbates@u...> wrote:
> At 09:42 PM 12/15/02 +0000, you wrote:
> >Hi all,
> >
> >I need to connect something like a rotary switch (preferr a pot)
to
> >a Stamp and want to use a minimal number of pins.
> >
> >I have 20 seperare conditions. all fed from one device.
> >
> >Actually, I would like to use a pot to a chip and have that chip
then
> >signal the stamp.
> >
> >speed is the problem, the input must be on the pins and not serial
as
> >the serial takes too long.
> >
> >The pot is preferred only as a pot is cheap and a 20 posistion
switch
> >is expensive.
> >
> >any suggestions ?
> >
> >Dave
> >
> >Dave -
>
> Take a look at App Note 18 in the Basic Stamp I Applications
Manual. If you
> don't have on, contact me off list, and I'll send it to you. It can
be
> adapted to the Basic Stamp II. This uses ONE PIN for nearly as many
switches
> as you may want.
>
> Regards,
>
> Bruce Bates
>
>
>
> >To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> >from the same email address that you subscribed. Text in the
Subject and
> >Body of the message will be ignored.
> >
> >
> >Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
I have an adaptation of the "Many switches, one pin" app note posted at
<http://www.emesystems.com/BS2rct.htm#switches>
The example shows 5 switches with a maximum acquisition time of 150
microseconds. A linear pot would work there just as well. With 20
switches (or marks on a pot), you could still do it in about 200
microseconds, if you use 10 microsecond time slices, instead of the
30 microseconds I used in the example.
Remember, you are not going to get much faster than 200 microseconds
with a BS2, because it takes about that to interpret each
instruction, regardless.
-- best regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
> >Hi all,
> >I need to connect something like a rotary switch (preferr a pot) to
> >a Stamp and want to use a minimal number of pins.
> >I have 20 seperare conditions. all fed from one device.
> >Actually, I would like to use a pot to a chip and have that chip then
> >signal the stamp.
> >speed is the problem, the input must be on the pins and not serial as
> >the serial takes too long.
> >The pot is preferred only as a pot is cheap and a 20 posistion switch
> >is expensive.
> >any suggestions ?
> >Dave
> >Dave -
>
>Take a look at App Note 18 in the Basic Stamp I Applications Manual. If you
>don't have on, contact me off list, and I'll send it to you. It can be
>adapted to the Basic Stamp II. This uses ONE PIN for nearly as many switches
>as you may want.
>
>Regards,
>
>Bruce Bates