When a switch or pushbutton is closed the metal contacts bounce before coming to rest, effectively opening and closing the switch many times. This is of no importance for many applications (e.g. a light bulb), but when you want the switch to trigger a single event (e.g. a keyboard key), bouncing is problematic since the switch would trigger many events.
A switch debouncer is a small circuit that generates a single “clean” pulse when a physical switch or pushbutton closes.

Here is a state transition diagram for the debouncer followed by a nice schematic.
Note: count_en, count and cout (carry out) refer to the inputs and outputs of the counter on the debouncer schematics (see below), Δt stands for the number of clock cycles the pulse should last, PB = 1 means that the pushbutton has been pushed, and Q₁ and Q₂ refer to the output of the S-R latches.


Note: The AND gates on the right-hand side (the ones that have NOTed inputs) are used to compare the counter count with the number of clock periods the pulse should last. By correctly setting their inputs, the pulse width can be changed to any number of clock cycles. Similarly, the 160 ms wait time is also easily customizable.
No comments:
Post a Comment