1ms sample interval for debounce

MrChips

Joined Oct 2, 2009
34,817
You are asking three different unrelated questions in one. Hence I cannot give you an answer.

1) You asked if I use blocking or non-blocking code.
2) You are asking if key scanning or interrupt driven event handling is better.
3) You asked how to detect a steady button state.

All three questions are separate questions.
 
In a spreadsheet, positioned in any cell, depress any letter and hold it down for exactly 10 seconds. Let's say that's in cell A1. In another cell, write the formula "=LEN(A1) to find out how many letters there are in cell A1.

Effectively, when a key press is registered that key press is acknowledged and ignored for a given time so if the key is held down the letter will repeat when that time has elapsed. So if you see 1,000 letters in 10 seconds that's 100 per second which implies 10mS delay before acknowledging the pressed key again. So this is effectively the de-bounce time
 

WBahn

Joined Mar 31, 2012
32,854
In a spreadsheet, positioned in any cell, depress any letter and hold it down for exactly 10 seconds. Let's say that's in cell A1. In another cell, write the formula "=LEN(A1) to find out how many letters there are in cell A1.

Effectively, when a key press is registered that key press is acknowledged and ignored for a given time so if the key is held down the letter will repeat when that time has elapsed. So if you see 1,000 letters in 10 seconds that's 100 per second which implies 10mS delay before acknowledging the pressed key again. So this is effectively the de-bounce time
There's no bouncing involved in the autorepeat process -- the system is fully aware that the key has never been released. The repetition rate is completely unrelated to the debounce time. The software has been programmed to record a single keystroke initially when a key is pressed, but if it is not released after X amount of time, to record repeated instances of that keystroke at a rate of Y characters per second until the key is released. The choice of X and Y are arbitrary and based on desired perceived behavior, not on switch bounce considerations.
 
Top