Pull-up/down resistors - Basic Question
SeanB
Posts: 4
Hey folks, I have what I fear is a really basic question, so please forgive my ignorance...
I am having trouble understanding some of the details behind the pull-up and pull-down resistors.· I get that the idea is to have the input read a 0 (Vss) or 1 (Vdd) when, for example, a pushbutton is open, but I guess my question is how do the pins "sense" (What's a Microcontroller p. 76) Vss?· It makes sense that it can "sense" Vdd - that's a 5v source.· But how does it know when its connected to Vss (which is ground, right?).· This is more of a general circuit question than a BS2 one, I suppose...
I'm missing something fundamental.· Please smarten me up [noparse]:)[/noparse]
I am having trouble understanding some of the details behind the pull-up and pull-down resistors.· I get that the idea is to have the input read a 0 (Vss) or 1 (Vdd) when, for example, a pushbutton is open, but I guess my question is how do the pins "sense" (What's a Microcontroller p. 76) Vss?· It makes sense that it can "sense" Vdd - that's a 5v source.· But how does it know when its connected to Vss (which is ground, right?).· This is more of a general circuit question than a BS2 one, I suppose...
I'm missing something fundamental.· Please smarten me up [noparse]:)[/noparse]
Comments
Adding a pull-down resistor to VSS, we commit that input low. When the button is pressed, the input goes to 5V.
The resistor is needed so when the button is pressed the Vdd and VSS do not cause a short circuit and draw excessive current.
Thus, a pull-down resistor with an Active-high switch.
The converse would be an active-low switch with a pull-up resistor (more common).
Many device inputs have pull-up resistors internal. The BASIC Stamp does not.
Hope this helps?
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Southern Illinois University Carbondale - Electronic Systems Technologies
Personal Links with plenty of BASIC Stamp info
StampPlot - Graphical Data Acquisition and Control
Thanks for the reply.
Yes, it does help, its just hard to wrap my head around.· Is current actually flowing when an input pin is connected to Vss?· From the pin to Vss or vice versa?· Or am I thinking about this totally wrong?
Thanks again,
Sean
Edit: "output pin" -> "input pin" (I type faster than I think [noparse]:)[/noparse])
Post Edited (SeanB) : 4/8/2006 8:15:08 PM GMT
As an input, it IS floating, therefore the state is not assured, therefore what you read may not be accurate. Pull-ups and pull-down force it to a state, and then the switch brings it to the opposite state.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Southern Illinois University Carbondale - Electronic Systems Technologies
Personal Links with plenty of BASIC Stamp info
StampPlot - Graphical Data Acquisition and Control
If I sound like I don't know what I'm talking about... its because I don't [noparse];)[/noparse]
Sean
·· The BS2px does have internal weak (20K) pull-up resistors that can be enabled.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Without getting deeper into the electronics theory, this is about all I can say to clarify what goes on.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Southern Illinois University Carbondale - Electronic Systems Technologies
Personal Links with plenty of BASIC Stamp info
StampPlot - Graphical Data Acquisition and Control
I appreciate the info.· As I said in my first post, this is all pretty new to me and its hard for me to wrap my head around some of the concepts...· You should see me try to reconcile the fact that a resistor's placement within a circuit is irrelevant (its scary, trust me ).
I think I understand well enough to continue moving forward.
If you or anyone else who happen upon this post again have recommendations for on or offline reading materials relating to basic electronics - electronics 101, as it were - that'd be great.· Either way, thanks for all your help.
Sean
When in OUTPUT HIGH, a driver transistor inside the PIC connects the pin to VDD. When in OUTPUT LOW, the first transistor is biased 'off' and a second transistor connects the pin to VSS. When in INPUT, both transistors are biased 'off', and the pin is routed to an input reciever.
Now, the input reciever has very high input impedance -- a meg-ohm to 10 meg-ohms between the pin and Vss. So, if you select a pin for INPUT, and have nothing connecting it high or low, it 'floats' -- meaning any stray RF signal, across that meg-ohm, will generate enough voltage to trigger a high one moment, and a low the next. Your typically strongest RF signal is 60 Hz, coming from flourescent lights, by the way.
Now, if you tie that pin to ground with a 10 Kohm resistor, you have a 'soft' zero. Any stray RF gets 'grounded' through that resistor, and the pin stays at ground potential. If you put a 'normally open' pushbutton between that resistor and +5, the signal will stay low until you push the button.··When the button is pushed the signal will go high.
Now, if you merely tied the pin to ground with a wire, when you pushed the pushbutton you'd connect +5 directly to ground. This is commonly known as a 'short-circuit', and so much current would flow (briefly) that it might weld your switch shut. So that resistor is really needed in there.