Fix debounce internal links and add #interrupt section
This commit is contained in:
@@ -40,7 +40,7 @@ This configuration has a few advantages:
|
|||||||
- there is no keyboard scan....which helps keep scan-noise out of the power supply; helpful in an audio environment
|
- there is no keyboard scan....which helps keep scan-noise out of the power supply; helpful in an audio environment
|
||||||
- can easily be set to wake-on-interrupt, which means that you can power down between keystrokes
|
- can easily be set to wake-on-interrupt, which means that you can power down between keystrokes
|
||||||
|
|
||||||
See [KeyBounce](#keyboard-bounce) below.
|
See [KeyBounce](#keyboard-debounce) below.
|
||||||
|
|
||||||
Of course, this solution does not apply to a keyboard which has *rows* and *columns*.
|
Of course, this solution does not apply to a keyboard which has *rows* and *columns*.
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ idle CPU pin can be programmed as a logic
|
|||||||
input, and have interrupts enabled.
|
input, and have interrupts enabled.
|
||||||
Once a logic "high" is sensed, the CPU pin can be changed to an A/D pin,
|
Once a logic "high" is sensed, the CPU pin can be changed to an A/D pin,
|
||||||
and the voltage
|
and the voltage
|
||||||
measured (after a short pause). The 1nF capacitor helps with keyboard bounce;
|
measured (after a short pause). The 1nF capacitor helps with keyboard debounce;
|
||||||
the time constant is ~10us.
|
the time constant is ~10us.
|
||||||
|
|
||||||
Of course, if the user presses multiple keys simultaneously, the measurement will correspond to the highest voltage on that chart.
|
Of course, if the user presses multiple keys simultaneously, the measurement will correspond to the highest voltage on that chart.
|
||||||
@@ -135,7 +135,7 @@ This scheme can be configured for interrupt triggering
|
|||||||
columns are set to input+pullup+interrupt.
|
columns are set to input+pullup+interrupt.
|
||||||
Any keypress will then pull at least one column line low. Once the
|
Any keypress will then pull at least one column line low. Once the
|
||||||
interrupt is triggered, change to the logic described above, scan the keyboard
|
interrupt is triggered, change to the logic described above, scan the keyboard
|
||||||
[over the [debounce period](#keyboard-bounce) and then restore they keyboard
|
[over the [debounce period](#keyboard-debounce) and then restore they keyboard
|
||||||
to the "ready-for-interrupt" configuration.
|
to the "ready-for-interrupt" configuration.
|
||||||
|
|
||||||
### 3x4 plus Ground [new design]
|
### 3x4 plus Ground [new design]
|
||||||
@@ -264,6 +264,20 @@ can happen.
|
|||||||
[Here](keyboard.c) is some example code to illustrate this decode; in C;
|
[Here](keyboard.c) is some example code to illustrate this decode; in C;
|
||||||
look for the symbol **FOUR_PIN**. Here is a working prototype. 
|
look for the symbol **FOUR_PIN**. Here is a working prototype. 
|
||||||
|
|
||||||
|
### Interrupts
|
||||||
|
|
||||||
|
These small keypads can be scanned continuously; you probably want to revisit the
|
||||||
|
keypad every 50ms or so to make sure you don't miss any keypresses.
|
||||||
|
|
||||||
|
Changing to an interrupt-driven scheme allows you to relax about missing any keys;
|
||||||
|
you are guaranteed to get an interrupt on each key press. It also allows you to
|
||||||
|
power down the system until a key is pressed.
|
||||||
|
|
||||||
|
Most of the designs above allow for an interrupt-driven configuration. Simply
|
||||||
|
set the column pins as "input-pullup-interrupt".
|
||||||
|
|
||||||
|
Bear in mind: if the user presses a 2nd key while the 1st key is still depressed,
|
||||||
|
an interrupt will *not* be generated.
|
||||||
|
|
||||||
### Keyboard Debounce
|
### Keyboard Debounce
|
||||||
|
|
||||||
@@ -298,10 +312,6 @@ One involves using an SPI output and a shift register
|
|||||||
<https://hackaday.com/2015/04/15/simple-keypad-scanning-with-spi-and-some-hardware/>
|
<https://hackaday.com/2015/04/15/simple-keypad-scanning-with-spi-and-some-hardware/>
|
||||||
This design requires an external chip ($0.10), 8 diodes and 4 resistors.
|
This design requires an external chip ($0.10), 8 diodes and 4 resistors.
|
||||||
|
|
||||||
### Interrupts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Reading DIP switches
|
### Reading DIP switches
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user