Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

software switch debounce time???????

Status
Not open for further replies.

d@nny

Full Member level 5
Joined
May 28, 2011
Messages
246
Helped
11
Reputation
22
Reaction score
11
Trophy points
1,298
Activity points
3,238
hello!
what is the safest time to key debounce?
i am using this technique
key pressed detect
wait 10ms
check state of key
key is pressed = process the data
wait for key released
key released = wait 10ms = returned
is this the safest time or i need to increase it for more accuracy
thanking you in anticipation
 

10ms seems to be reasonable.

However, the method of keep waitiing in a closed loop, can waste a lot of processing of CPU.
Better to handle it by interruption timming.

+++
 

You can also use polling using a timer interval so that the code execution doesn't stop while waiting.
If you set a timer to give an interrupt every 10ms then you can read the input and set a flag variable with the button state and then read that flag in the main loop and do the rest.

Alex
 

Here are a couple of nice links to Ganssle's studies. The first studies the time needed and gives data.

The second gives some software advice.

Debouncing
Debouncing

John
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top