Exhibition / Gallery
Topic: Software Debounce
(Read 32 times)
This is my custom title
Programmer. Last used C in anger - ooh - about '95.
Aug 01, 2015, 10:02 am
: Aug 01, 2015, 10:11 am by PaulMurrayCbr
Second time lucky!
The attached sketch implements a software debounce, using cactusjack's
Elegant debouncing solution with software Schmitt trigger emulation
The filter uses two chained low-pass filters, a trigger, and I also tweaked it by adding code to saturate the filters when a state change occurs, hopefully adding more insurance against bouncing.
The sketch requires an input button, and four output LEDs.
The first LED is the data off the input button, sampled at 4ms intervals.
The second LED shows the input data with 25% of the bits discarded and replaced with random noise.
The third LED shows the result of debouncing. It's clean and slightly delated.
The fourth LED counts the clicks by flashing 250ms.
downloaded 4 times