0
\$\begingroup\$

I understand that key debounce has to be considered either in Hardware (HW) or in software (SW) when we press a switch (to avoid make and breaks). Do we need to take care of key debounce even for key release? (make and break is possible even during release I guess). But since we are considering debounce for key press actions (I am considering in SW), anyway we won't get key pressed output even if "make" is detected when we release the key. If we go for hardware based key debounce (I am not hardware person), does it take care of both press and release conditions?

\$\endgroup\$
1
  • \$\begingroup\$ Probably: just measuring it would give you the answer, but I'd wager that when the contacts are separating, if your environment has any bit of vibration they might touch a few times while disconnecting. Not to mention, if the contacts rub while disconnecting, they will cause bounce. \$\endgroup\$
    – hatsunearu
    Commented May 19, 2018 at 14:29

1 Answer 1

1
\$\begingroup\$

Generally you want to detect a keypress. (This isn't always the case: in most GUIs such as Windows, etc., the action isn't performed until the key is released. This allows moving the cursor off the button to cancel the request. Since there is no direct equivalent in hardware this does not apply to your situation.)

I understand that key debounce has to be considered either in Hardware (HW) or in software (SW) when we press a switch (to avoid make and breaks).

A better wording might be "to avoid reading normal contact bounce as multiple press and release actions".

Do we need to take care of key debounce even for key release? (make and break is possible even during release I guess).

This is up to the user requirements.

             _   _   _   _____________________   _
Input ______| |_| |_| |_|                     |_| |___________
                             _________________
Status _____________________|                 |_______________
                         <--> debounce time

Figure 1. Debounced rising edge. Instantaneous falling edge.

But since we are considering debounce for key press actions (I am considering in SW), anyway we won't get key pressed output even if "make" is detected when we release the key.

Correct. As shown in Figure 1 the bounce on key release doesn't retrigger because it's not long enough.

If we go for hardware based key debounce (I am not hardware person), does it take care of both press and release conditions?

It depends on the design.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 2. (a) Quick discharge. (b) Slow discharge.

For example, in Figure 2a SW1 will pull the input low instantly but it will take about 10k x 100n = 1 ms to charge back up again. In Figure 2b R3 means that C2 is slow to charge and discharge giving debounce in both directions.

You can read some more about both hardware and software at AllAboutCircuits.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.