Only 64 Keys
To start I have assumed only 64 keys (maximum) are available for the keyboard. The first key is mapped as code as 0, the last key as code 63. Here is my keyboard switch schematic with the final key mappings (n.b. keys 04, 05 and 06 will not be used):
Extracting a code from the switches without column and row scanning (which is why a microprocessor is usually used) requires some analog to digital logic (the PNP transistors in the schematic):
This is the basic keyboard schematic that will map the the key code (not the ASCII code).
The column codes are A0-2 and the row codes are A3-5.
As I am using key code "0" I need to know that a key has been pressed, this logic is added to test if a key is pressed:
Remapping keys and the Shift Key
We need to add "shift key logic" to remap the key code to ASCII codes, and to map the lower case or shift upper case logic to the keyboard.
Here is an example of decoding logic ("the basic shift") that could be used to remap keyboard codes to ASCII codes:
Problems with the Basic Shift
The basic key shift does 95% of the work needed for a practical keyboard but there are problems:
- the space (" ") is accessed by shifting "0"
- the "DEL" is shift "_"
- the "ESC" and "CAN" (i.e. Break) are not accessible.
We therefore need to remap some individual key codes around.
Remapping individual keys is expensive.
AlanX
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.