KEYCODES
Each key has a keycode associated with it (see accompanying Table). Keycodes are
always 7 bits long. The eighth bit is a "key-up"/"key-down" flag; a 0 (high level) means
that the key was pushed down, and a 1 (low level) means the key was released (the CAPS
LOCK key is different – see below).
For example, here is a diagram of the "B" key being pushed down. The keycode for "B" is
$35=00110101; due to the rotation of the byte, the bits transmitted are 01101010.
___
___
KCLK
\_/
\_/
_______
KDAT
\__________/
0
1
In the next example, the "B" key is released. The keycode is still $35, except that bit 7 is
set to indicate "key-up," resulting in a code of $B5 = 10110101. After rotating, the
transmission will be 01101011:
___
___
KCLK
\_/
\_/
_______
KDAT
\__________/
0
1
CAPS LOCK KEY
This key is different from all the others in that it generates a keycode only when it is
pushed down, never when it is released. However, the up/down bit is still used. When
pushing the CAPS LOCK key turns on the CAPS LOCK LED, the up/down bit will be 0;
when pushing CAPS LOCK shuts off the LED, the up/down bit will be 1.
___
___
___
\_/
\_/
\_/
______
\____/
1
0
___
___
___
\_/
\_/
\_/
______
\____/
1
0
- Appendix H 345 -
___
___
___
\_/
\_/
______
____________
\____/
1
0
1
___
___
___
\_/
\_/
______
\__________/
1
0
1
_______
\_/
0
_______
\_/
______
0