This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to calculate denounce time for a Switch

Other Parts Discussed in Thread: MSP430F5338

Dear Members,

I am working with MSP430F5338 and push switch, in that I have asked to implement a debouncing logic for a push switch. As per my understanding deboucing period is "a time required to evaluate whether the Switch has been really pressed or not". So whenever the switch is pressed, the timer will start to run and whenever the switch is released the timer will be stopped. Now we have to compare the start and stop time difference is greater than debunce time. Here my question is how can calculate the debounce time? What are all factors to be considered this debounce time? Is it depends on H/W circuit? Also if any reference document available please share.

Thanks in advance!

  • Hi Prakash,

    Not only does debouncing evaluate whether a switch has been pressed or not, it makes sure that the signal does not "bounce" and cause a false trigger. You can calculate your hardware's RC time constant or use an oscilloscope to evaluate how much time is needed between when the button is pressed and when the signal settles at a voltage level. You can also try out different pause implementations to see which one you prefer. Several debouncing examples are provided online, using anything between __delay_cycles to timers, and typically last from 1 to 100 ms.

    Regards,
    Ryan