Re: Switch debouncing



On Tue, 27 Dec 2005 20:27:30 -0600, Abstract Dissonance wrote:

> For one of my projects I decided to use a momentary switch(where its held on
> as long as you push it in and when you release it will disconnect... I think
> its called momentary switch). The switch basically selects presets and I
> will have a couple of them. The idea is like the buttons on a blender where
> you press one and it mechanically turns off all the others. I'm trying to do
> the same thing digitally. i.e., if I press button A it will turn off all the
> others(only one will be on ofcourse). I do this by basicaly using toggle
> FF's.
....
> The circuit is
>
> ---- Schmitt Trigger - Out
> |
> V --- R1 --+-- Switch --- R2 --- GND
> |
> --- C1 -- GND

Notwithstanding what Ben Bradley said about an R-S flip-flop if it gets
multiple "sets" or "resets", to answer your debouncer question, lose R2,
and go directly from the switch to ground:

> ---- Schmitt Trigger - Out
> |
> V --- R1 --+-- Switch ------ GND
> |
> --- C1 -- GND

That will immediately discharge the capacitor, and with the Schmitt, it
doesn't matter how long as it takes to charge, as long as it's quicker
than the next time they push the button! ;-)

There are also "Jeopardy buttons"-type circuits on the internet, which
would give you your lockout, but with independent buttons, you might
even not need that much logic - there isn't going to be any competition
between the buttons, so you don't need a priority resolver, just a - OK,
I think I've got it.

Take another capacitor, from the switch/R1/cap/ST junction, about 1 nf,
and on its other side, put a 1K or so resistor to +Vcc. Condition that
with a couple of diodes, (one each to +Vcc and to ground, reverse biased,
of course - this clamps the spike), and send it to the "reset" of _all_
of the flip-flops. It resets them, and then the "set" signal from your
button sets the target flop.

Kewl! I'll try not to dislocate my elbow patting myself on the back. :-)

Cheers!
Rich

.


Quantcast