This section discusses some common techniques to ``filter'' raw input
from the pins of an MCU. Both techniques can use push buttons as examples.
In this context, we assume a push button is ``normally open''. This means
when the push button is not being pushed, the two electrical contacts
are not connected. When the push button is pushed, the two electrical
contacts are connected.
A typical use of such NO (normally-open) push buttons is to connect one
end to ground, and another end to a binary input pin that has a pull-up.
This way, there are two states:
- When the button is released, there is no connectivity to ground.
As a result, the binary input pin goes to its default state.
Due to the pull-up configuration, the default state is high.
In software, this pin reads 1.
- When the button is pushed, it connects the binary input pin
to ground (0V). This connection results in a very strong
``force'' to change the voltage at the binary input pin to 0V.
As a result, the default pull-up is overcome, and the binary
input pin reads 0.
The bottom line is: 0 means pressed, 1 means released.
Subsections
Copyright © 2006-02-15 by Tak Auyeung