Advertisement
Advertisement

Follow the debouncing flip-flops

-February 17, 2000

During a recent development effort, we could not find literature detailing how to debounce an spst momentary switch using only logic (no capacitors, Schmitt triggers, or other components). Our application placed the spst switches several feet from the logic board, and both noisy switches and line transients caused false triggers. Many methods simulate a debounce by checking the state of the switch on clock edges and summing the checks over time, but our application required no transitions during the qualification time before acknowledgment of a key press. Thus, the switches can work effectively in noisy environments over reasonably long distances. Figure 1 illustrates a means of debouncing a momentary switch for both the make and the break operations. Designers often use programmable logic to debounce momentary switches used in keypads, in keyboards, or as configuration inputs. Flip-flops are usually precious commodities in programmable logic, whereas logic gates are available in greater abundance. The design in Figure 1 minimizes the use of flip-flops.

The circuitry monitors the state of the Switch input. Once the circuit detects a transition, a "qualifying" time of two Debounce_Clock periods begins. If at any time during the qualifying time the Switch input returns to its original state, indicating switch bounce or an electrical transient, the circuitry returns to its starting state and begins looking for another transition. The Switch input must be completely stable for two positive transitions of the Debounce_Clock input before the Switch_Debounced output will change. A frequency of approximately 15 Hz (or a period of 66 msec) for the Debounce_Clock input works well, even for low-cost, "noisy" switches. You can delete the reset logic if you are unconcerned with the power-on state of the Switch_Debounced output. Following power-on, the output will be correct after two clock periods. (DI #2481)

Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES