Page 1 of 1

switch debounce

Posted: Sun Dec 05, 2021 7:20 pm
by siliconchip
hi all,
my question concerns switch debounce when connecting a switch to a pic micros input, whats the best method for the PIC, ive seen circuits using the cmos 40106 schmitt trigger with a couple of resistors and a cap, or just a switch with a cap and resistors or is the software method better ??, i did read some where that pic micros dont like just a cap and resistors with a switch on their inputs ?? and prefer the schmitt approach id appreciate any comments thanks in advance

bob

Re: switch debounce

Posted: Sun Dec 05, 2021 10:09 pm
by medelec35
Hi Bob.
If you use the switch component, then that will have a debounce option within properties.
The reason for debounce is because the microcontroller can so fast a switch detection, it will count the times the switch contacts have vibrated when the intention was just to detect a single switch event.
The other way is to have an input, then a decision branch if the switch is detected.
Within the decision branch, have a delay that will cover the maximum bounce duration e.g 10 to 50ms
Both methods should work well.

Re: switch debounce

Posted: Sun Dec 05, 2021 10:42 pm
by siliconchip
Hi Martin
as always thanks for the reply so it's safe to say that the software debounce is just as good as the hardware variants plus with the added bonus of a lower component count

Bob

Re: switch debounce

Posted: Sun Dec 05, 2021 10:59 pm
by medelec35
You're welcome.
The answer is yes.
I have never used external components for switch debounce. I have used both software methods for great reliability in my projects.

Re: switch debounce

Posted: Sun Dec 05, 2021 11:45 pm
by siliconchip
Thanks Martin 👍👍