I came across an article in this months Circuit Cellar talking about switch
debouncing, and it seemed overly complex to me. Here's what I've done
in the past.
For a hardware based design, I feed a switch to the D input of a flip-flop
and continuously clock the FF at 50-100hz (obviously ground 1 input
of the switch and use a pull-up resistor on the other side of the switch which
goes to the FF). Just pick the clock rate to have a period longer than it
takes the bouncing to die out. Sure, there's a slight risk of metastability
issues, but you could just cascade a second FF on the output of the first
if you were really concerned about that.
In software, do something similar in that have a interrupt routine called
at 50-100hz, poll the switch, and put the result in memory somewhere.
Use the memory as the true state of the switch.
I've seen some hacks like putting capacitors across the switch, but that
just seems like a horrid design choice to me.
Any other good ways to do this?
Scott