[프로세서]

Digital Debounce Filter (glitch filter)

Neo Park 2019. 11. 1. 15:24



1. Theory of Operation

When acquiring digital signals in an industrial or otherwise electromagnetic noisy environment, it is common to see some bounces on the acquired signals whenever the signal changes state. These bounces appear as extra pulses close to the actual transition of a digital signal. When processing digital signals for pulse counts such as a quadrature encoded value, it is desirable to avoid theses bounces or eliminate them before processing the signal. This type of filtering or processing is commonly called debouncing as it removes the bounces from the digital signal.

The following time diagram shows a typical digital signal with some bounces and the corresponding sampled data. The Unfiltered Sampled line shows the data as it it acquired by a digital input channel which samples the signal at a defined sample clock rate. Note that the unfiltered sampled data does not see changes in the signal until the next clock cycle of the sample clock. This means any very short pulses between two clock cycles are not observed at all. Short bounces in the signal that happen to occur across a clock cycle are observed in the sampled data.



Figure 1: Example of a raw signal and the sampled data using a clocked digital input 


A common algorithm for debouncing a digital signal is to process the raw (unfiltered) sampled data and only pass through a change in state whenever the sampled data has remained constant for a defined period of time. Any pulses shorter than the filter time constant are removed and not passed through. The following graph shows the same signal, the raw (unfiltered) sampled data and the debounced (filtered) data using a time constant of two sample clock cycles.  In order to avoid counting extra pulses in our signal the sampled data is filtered by looking for pulses that hold the same state for at least two clock cycles before the change in state is passed to the output. Using the debounce filter extra short pulses (bounces) that are present in the unfiltered sampled data are removed. The red circles in the timeline indicate when the unfiltered data has remained constant for two clock cycles at which point the filtered data state is updated.



Figure 2: Time waveforms of a raw signal, the unfiltered and filtered (debounced) sampled data


참조 : http://www.ni.com/example/31251/en/