Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/03/02 13:55
Read: times


 
#33658 - switch debouncing
Not specifically an 8051 question, but still a relevant one.

Every reference I look at on switch debouncing in software describes the same basic algorithm:
1. Read switch - is it pressed?
2. If yes, wait 30ms or so and see if it is still pressed. If so, process the press. If not, discard.

Now assuming that we don't have some hardware problem like noise on switch lines, why don't we do this?
1. Read switch. If it is pressed, process the change.
2. Discard any state change for about 30ms.

The difference is nothing on an alpha-keyboard. But it might mean something on something like, say, a pro-audio system where the switch controls the 'record' button.

Anyone care to comment? Is there a good reason not to do the second way?

List of 32 messages in thread
TopicAuthorDate
switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing - Jon            01/01/70 00:00      
RE: switch debouncing - Jon            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing - digital cameras            01/01/70 00:00      
RE: switch debouncing - digital cameras            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing - digital cameras            01/01/70 00:00      
RE: switch debouncing - Jon            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      
RE: switch debouncing            01/01/70 00:00      

Back to Subject List