Debouncing Techniques

Mechanical switches and moving mechanical parts in general do not simply stop when they reach their destination - they vibrate or "bounce" before coming to rest. Consider a mechanical on/off motor switch that is polled by software. If the software blindly turns the motor on when the switch is down, and off when the switch is up, the motor may be turned on and off multiple times before the switch finally comes to rest. Software must do more than check the position of the switch - it must determine when the switch has settled into position.

The number of milliseconds to pause is determined empirically. A debugger is handy for the iterative process of trying different values. Note also that it is assumed that when the task yields, that it will resume quickly, otherwise, the algorithm may not work properly.

View Entire Paper | Previous Page | White Papers Search

If you found this page useful, bookmark and share it on:

 
Embedded Star Newsletter
Don't have time to visit Embedded Star everyday? Then sign up for our free newsletter. We'll send you an email when we have something to share with you. Your email address will be kept confidential and we will not share, sell, or rent it to anyone. You can unsubscribe at any time by clicking a link in the email.

Enter your email address to sign up for our free newsletter:   

If you are familiar with RSS feeds, you can also sign up for our free blog feed. Our RSS feed is updated in real-time while our newsletter is updated daily.