Understanding Active-low and Active-high circuits
Blackwolf189
Posts: 2
On page 76 and 79 in What's a Microcontroller, can someone please explain to me how this circuit works. Why is there a resistor from P3 and how is the current traveling when the button is pushed and when it is released?
Comments
Regarding pages 76 and 79 of the What's a Microcontroller.· When the button is pressed it completes the circuit as in the flow of current.· When the button is not pressed it acts like an "open" in the circuit (no current flow).· The 220 ohm resistor is used for the protection of the I/O pin against reverse current.· The 10k ohm resistor is to stop the I/O pin from floating.
Thanks,
Dave
Thanks,
Dave
If an input pin·does not have a pull-up resistor (resistor from input to +5v) or the input pin does not have a pull-down resistor (resistor from input to ground) the pin is said to be floating.....
You cannot guarantee if the pin will stay at a logic 1 or logic 0.· In fact, you can be pretty darn sure whatever state it is in while floating, it will randomly changes states...
The voltage present on the input pin determines if the pin is in a logic 1 or·0, and when·there·is no pull-up·or pull-down resistor, the·state changes at random....imagine·a voltage on the pin drifting above and below the threshold for a logic 1·and logic 0......hence the term, floating.
Ken Mathis
Floating pins are also the hardest things to troubleshoot. You're there at 1AM trying to figure out why P7 is reading a "0" when it finially hits you that your missing a pull-up resistor. My advice is to have some 10K resistor-networks handy. I would petition Parallax to include these on the stamp chips but sometimes you need pull-ups and sometimes you need pull-downs.
Paul Coy
Good question. For what I do in regular logic away from the stamps I typically start up with a 100 resistor. And then typically end up with either a 2K or 2.2K. YMMV
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buck Rogers
www.gregg.levine.name
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
If you measure the current that flows thru a 10k or a 1k you will see why 10k is better, in battery/power conserving situations.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
happend if there is both a pull-up and a pull-down at the sametime?· Would that just nullify everything and put the
pin back to a potential floating state?· I know common sense would say noone would do it, but I'm just curious.
Post Edited (shawnpwilson) : 12/2/2005 5:02:34 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Let's say you attached two 10k resistors to an I/O pin, one to Vdd, one to Vss -- what you've done is attached a voltage divider to that pin and you'll have about 2.5 volts on the input.· This will look like a "1" because the input threshold (for the BASIC Stamp)·is 1.4 volts.
It's very easy to over-think these simple things and let them get in the way of actually doing a project.· Trust that engineers have been using pull-ups and pull-downs for a long time and that they do in fact serve their intended purpose.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Well, good.· I learned a few things here.· I learned what "floating" is and how it can adversely affect an I/O pin; I've learned how to stablize an I/O pin to either a logic·level·of 1 or 0; and I learned how to divide a Voltage.
Actually, I bought a WAM from radioshack·lastweek but haven't hooked it up just yet.· Thought I'd read through the manual and browse around the forums a little bit first.
Parallax is a great starting place for any beginner as they have a great deal of supportive material and very responsive individuals who help others.
Thanks all for your responses and I look forward to asking many more questions down the road.