| ??? 12/03/02 18:31 Read: times |
#33692 - RE: switch debouncing |
If you want the absolute best response time to a bouncing switch, then debounce it in hardware.
absolutely. Switch debouncing time in software takes less than 5msec. The most efficient way of doing it in software is to take 4 samples at 1 msec interval say. then use what is called vertical counters ( counters built with state machines in software) If a state change was detected then get the rest of the samples, if they where all the same then consider the keypress valid, otherwise reset the vertical counter and start counting again. Check this link pic debouncing . the algorithm is intended for pic but I used it as is for 8052 and it worked. They claim that you can de-bounce 8 switches at a time. but I used it do de-bounce 32 switches at the same time using C language. long int is 32 bits and so u can use same algorithm to decode 32 keys simultaneously. Regards Mahmood |



