Ver código fonte

Fix debounce internal links and add #interrupt section

Pat Beirne 1 mês atrás
pai
commit
53da8d3918
1 arquivos alterados com 17 adições e 7 exclusões
  1. 17 7
      keypad_to_microcontroller.md

+ 17 - 7
keypad_to_microcontroller.md

@@ -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
 - 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*.
 
@@ -91,7 +91,7 @@ idle CPU pin can be programmed as a logic
 input, and have interrupts enabled. 
 Once a logic "high" is sensed, the CPU pin can be changed to an A/D pin, 
 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.
 
 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. 
 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 
-[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.
 
 ### 3x4 plus Ground [new design]
@@ -264,6 +264,20 @@ can happen.
 [Here](keyboard.c) is some example code to illustrate this decode; in C; 
 look for the symbol **FOUR_PIN**. Here is a working prototype. ![working](keypad.jpg)
 
+### 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 
 
@@ -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/>   
 This design requires an external chip ($0.10), 8 diodes and 4 resistors.
 
-### Interrupts
-
-
-
 
 ### Reading DIP switches