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: