NEWBIE input question.
As I've mentioned before, I'm pretty new to stamps, so no laughing [noparse]:)[/noparse]
I'm trying to use pin1 as in input, with a switch and a 10k
resistor.
The problem I am having is that when the switch is 'open' the state
of the pin changes from 0 to 1 aparently randomly. (even the book
said it would) And if the switch is closed, the state is ALWAYS 1.
So how can I check the state of the pin and trust what it says? It
doesnt seem to matter if I write a 0 to the pin 1st or not, if the
switch is open, the results are anyone's guess [noparse]:)[/noparse]
Thanks in advance,
John
I'm trying to use pin1 as in input, with a switch and a 10k
resistor.
The problem I am having is that when the switch is 'open' the state
of the pin changes from 0 to 1 aparently randomly. (even the book
said it would) And if the switch is closed, the state is ALWAYS 1.
So how can I check the state of the pin and trust what it says? It
doesnt seem to matter if I write a 0 to the pin 1st or not, if the
switch is open, the results are anyone's guess [noparse]:)[/noparse]
Thanks in advance,
John
Comments
the resister should be opposite of switch.
so when switch is off the pin should read what ever the resister is tied to.
when you press switch the pin changes state.
when released the resister pulls pin the other way.
hope this helps
victor
Original Message
From: <john@l...>
To: <basicstamps@yahoogroups.com>
Sent: Saturday, September 08, 2001 2:19 PM
Subject: [noparse][[/noparse]basicstamps] NEWBIE input question.
> As I've mentioned before, I'm pretty new to stamps, so no laughing [noparse]:)[/noparse]
>
>
> I'm trying to use pin1 as in input, with a switch and a 10k
> resistor.
>
> The problem I am having is that when the switch is 'open' the state
> of the pin changes from 0 to 1 aparently randomly. (even the book
> said it would) And if the switch is closed, the state is ALWAYS 1.
>
> So how can I check the state of the pin and trust what it says? It
> doesnt seem to matter if I write a 0 to the pin 1st or not, if the
> switch is open, the results are anyone's guess [noparse]:)[/noparse]
>
> Thanks in advance,
>
>
> John
>
>
> 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'll go give that a try.
-John
At 01:31 PM 9/8/01 -0500, Al Williams wrote:
>This sounds like you don't have the resistor in the right place. Here's how
>it usually works:
>
>Connect one end of the 10k resistor to +5V and the other end to the Stamp
>pin. This is a PULL UP resistor. Now the Stamp will consistently read a "1".
>Connect the switch from the pin to ground. When you push the switch you will
>consistently read a "0". The purpose of the resistor is to prevent you from
>short circuiting your power supply when you push the button. Without the
>resistor you'd draw lots of current until something blew up. With the
>resistor you will draw about 5/10K or about 500uA which is no big deal (the
>Stamp input is essentially an open circuit).
>
>With the Stamp and certain other types of ICs you can reverse this to use a
>pull down resistor if you like. However, with some logic families like TTL
>pull up resistors make sense and pull down resistors don't. That's because
>those logic families don't provide as much current at a 1 output as they do
>with a 0 output.
>
>So not in the general case, but with the Stamp, you could connect the
>resistor to ground and the switch to +5V and still be OK.
>
>Regards,
>
>Al Williams
>AWC
>* Connect your Stamp to the Internet
>http://www.al-williams.com/awce/netporter.htm
>
>
> >
Original Message
> > From: john@l... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=k0FVrXfo6xmxpJ77SfFDan9wXzY8XJXU1ngo7VlUb_kF6RP6XaZJQYTyhIg8BGc1k0ck75xu]john@l...[/url
> > Sent: Saturday, September 08, 2001 1:20 PM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] NEWBIE input question.
> >
> >
> > As I've mentioned before, I'm pretty new to stamps, so no laughing [noparse]:)[/noparse]
> >
> >
> > I'm trying to use pin1 as in input, with a switch and a 10k
> > resistor.
> >
> > The problem I am having is that when the switch is 'open' the state
> > of the pin changes from 0 to 1 aparently randomly. (even the book
> > said it would) And if the switch is closed, the state is ALWAYS 1.
> >
> > So how can I check the state of the pin and trust what it says? It
> > doesnt seem to matter if I write a 0 to the pin 1st or not, if the
> > switch is open, the results are anyone's guess [noparse]:)[/noparse]
> >
> > Thanks in advance,
> >
> >
> > John
> >
> >
> > 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/
> >
>
>
>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/
it usually works:
Connect one end of the 10k resistor to +5V and the other end to the Stamp
pin. This is a PULL UP resistor. Now the Stamp will consistently read a "1".
Connect the switch from the pin to ground. When you push the switch you will
consistently read a "0". The purpose of the resistor is to prevent you from
short circuiting your power supply when you push the button. Without the
resistor you'd draw lots of current until something blew up. With the
resistor you will draw about 5/10K or about 500uA which is no big deal (the
Stamp input is essentially an open circuit).
With the Stamp and certain other types of ICs you can reverse this to use a
pull down resistor if you like. However, with some logic families like TTL
pull up resistors make sense and pull down resistors don't. That's because
those logic families don't provide as much current at a 1 output as they do
with a 0 output.
So not in the general case, but with the Stamp, you could connect the
resistor to ground and the switch to +5V and still be OK.
Regards,
Al Williams
AWC
* Connect your Stamp to the Internet
http://www.al-williams.com/awce/netporter.htm
>
Original Message
> From: john@l... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=zOvtzFPSnNpL51eFHd0FVSKpxcZ4GBp3UetNRMgD5-O2hXOrvFupxQPzi9QZ-zLw_BVLvbWVv2jH]john@l...[/url
> Sent: Saturday, September 08, 2001 1:20 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] NEWBIE input question.
>
>
> As I've mentioned before, I'm pretty new to stamps, so no laughing [noparse]:)[/noparse]
>
>
> I'm trying to use pin1 as in input, with a switch and a 10k
> resistor.
>
> The problem I am having is that when the switch is 'open' the state
> of the pin changes from 0 to 1 aparently randomly. (even the book
> said it would) And if the switch is closed, the state is ALWAYS 1.
>
> So how can I check the state of the pin and trust what it says? It
> doesnt seem to matter if I write a 0 to the pin 1st or not, if the
> switch is open, the results are anyone's guess [noparse]:)[/noparse]
>
> Thanks in advance,
>
>
> John
>
>
> 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/
>
switched to an output and is set high? This is what's mentioned in some of
the articles I have been reading, as well as the switch circuit on the
Activity Board, if I remember right.
Original Message
> This sounds like you don't have the resistor in the right place. Here's
how
> it usually works:
>
> Connect one end of the 10k resistor to +5V and the other end to the Stamp
> pin. This is a PULL UP resistor. Now the Stamp will consistently read a
"1".
> Connect the switch from the pin to ground. When you push the switch you
will
> consistently read a "0". The purpose of the resistor is to prevent you
from
> short circuiting your power supply when you push the button. Without the
> resistor you'd draw lots of current until something blew up. With the
> resistor you will draw about 5/10K or about 500uA which is no big deal
(the
> Stamp input is essentially an open circuit).
>
> With the Stamp and certain other types of ICs you can reverse this to use
a
> pull down resistor if you like. However, with some logic families like TTL
> pull up resistors make sense and pull down resistors don't. That's because
> those logic families don't provide as much current at a 1 output as they
do
> with a 0 output.
>
> So not in the general case, but with the Stamp, you could connect the
> resistor to ground and the switch to +5V and still be OK.
button and held it you could damage the Stamp output (high output, short
circuit to ground). The cure for this is not a pull up/down, but a small
series resistor between the pin and the switch. A 1K resistor, for example
would limit the current to 5mA.
Al Williams
AWC
* Floating point A/D
http://www.al-williams.com/awce/pak9.htm
>
Original Message
> From: Rodent [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=H5Ao8s5hjjJMnFLpIZGG3_9rgvMxJwbTKkJrWqtu85NoEHSt4nOTA73JSc3MYZiTOsCqyeQnBRBnYA]daweasel@s...[/url
> Sent: Saturday, September 08, 2001 5:39 PM
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] NEWBIE input question.
>
>
> Don't you also want a weak pulldown resistor in the event the
> Stamp pin gets
> switched to an output and is set high? This is what's mentioned in some of
> the articles I have been reading, as well as the switch circuit on the
> Activity Board, if I remember right.
>
>
Original Message
>
> > This sounds like you don't have the resistor in the right place. Here's
> how
> > it usually works:
> >
> > Connect one end of the 10k resistor to +5V and the other end to
> the Stamp
> > pin. This is a PULL UP resistor. Now the Stamp will consistently read a
> "1".
> > Connect the switch from the pin to ground. When you push the switch you
> will
> > consistently read a "0". The purpose of the resistor is to prevent you
> from
> > short circuiting your power supply when you push the button. Without the
> > resistor you'd draw lots of current until something blew up. With the
> > resistor you will draw about 5/10K or about 500uA which is no big deal
> (the
> > Stamp input is essentially an open circuit).
> >
> > With the Stamp and certain other types of ICs you can reverse
> this to use
> a
> > pull down resistor if you like. However, with some logic
> families like TTL
> > pull up resistors make sense and pull down resistors don't.
> That's because
> > those logic families don't provide as much current at a 1 output as they
> do
> > with a 0 output.
> >
> > So not in the general case, but with the Stamp, you could connect the
> > resistor to ground and the switch to +5V and still be OK.
>
>
>
>
> 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/
>
only am I new to stamps, I'm new to electronics!
Some day I'll know enough to help some too ! [noparse]:)[/noparse]
Thanks again,
John
At 02:25 PM 9/8/01 -0400, victor Faria wrote:
>John,is the resister tied to gnd or 5v?
*snip*snip*