Author Topic: a hardware-independent software debouncer  (Read 11181 times)

0 Members and 1 Guest are viewing this topic.

Offline klunkerbus

  • Supporter
  • ****
  • Posts: 162
  • Country: us
  • Electrical Engineer (retired early)
Re: a hardware-independent software debouncer
« Reply #50 on: June 10, 2016, 03:38:08 pm »
I'm debouncing in a 10ms timer IRQ
Using Peter D's code...

I've been meaning to mention the Danni/Dannegger debounce myself.  It was developed for AVR, but there's no reason why the algorithm couldn't be used on any hardware with some sort of periodic housekeeping interrupt where the switch inputs can be sampled.   I usually have one running at 1mSec or 5mSec intervals.  Crazy efficient; the code supports 8 inputs with the same processing cycles as one input. 

There's not much to the code but it can hard to understand, and sometimes I wish for more than 4 matching states in the vertical adder before change of state is detected.  But it usually works pretty good except on my crappiest switches.  Gurus and moderators in the AVRFreaks forum have a heyday blasting any other scheme.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf