piclist 2006\04\03\173351a
>
Thread:
debouncing in c
www.piclist.com/techref/microchip/languages.htm?key=c
BY
:
Scott Dattalo email (remove spam text)
David P Harris wrote:
> Wouter van Ooijen wrote:
>
>
>>>I am looking for an example to debounce several push buttons
>>>in c. While
>>>debouncing the micro shouldn´t be blocked by a timer.
>>>
>>>
>>
>>Easy method: check the buttons only each xxx ms. xxx must be longer than the bounce time. When unknown xxx = 50 ms is a good guess.
>>
>>Wouter van Ooijen
>>
>>
>
> You know this is dead simple, and I cannot think of any criticism of
> it. Nobody has commented otherwise, have they?
Well, no one's commented on it because the thread has only been alive
for a day or so. N*6 months ago when we last talked about this thread,
the same group of people chimed in as this time and this same point was
discussed (maybe it was discussed for N being even)! But Wouter's method
is more than sufficient for most cases - if the switch isn't bouncing,
then you can reliably read its state without having to resort to
elaborate filtering. My debouncing routine has its roots in RTU relay
time tagging; a environment far different than a snap dome.
But, there are at least two reasons why you might want a
debouncer/filter: 1) faster response 2) remove "spurious" transitions.
Both of these are probably insufficient reasons for normal switches. If
a switch can be pressed at a rate faster than it bounces, then it will
suffer from usability issues. If there are chances for spurious
transitions then there again usability issues.
<443194BC.4050802@dattalo.com> base64
In reply to: <44317632.3080004@telus.net>
See also: www.piclist.com/techref/microchip/languages.htm?key=c
Reply
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the
piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
month overview.
new search...