A host system may send 8-bit commands to the keyboard, while a keyboard may send commands and key codes to the system. System commands may be sent to the keyboard at any time. The keyboard will respond within 20 milliseconds, except when performing the basic assurance test (BAT), or executing a Reset command. The table below shows system commands and their hexadecimal values of a keyboard system.
Command | Hex |
---|---|
Set/Reset Status Indicators | ED |
Echo | EE |
Invalid Command | EF |
Select Alternate Scan Codes | F0 |
Invalid Command | F1 |
Read ID | F2 |
Set Typematic Rate/Delay | F3 |
Enable | F4 |
Default Disable | F5 |
Set Default | F6 |
Set All Keys - Typematic - Make/Break - Make -Typematic/Make/Break | F7 F8 F9 FA |
Set Key Type - Typematic - Make/Break - Make | FB FC FD |
Resend | FE |
Reset | FF |
Keyboard Commands
Table below shows the commands that the keyboard may send to the system and their hexadecimal values.Command | Hex |
---|---|
Key Detection Error/Overrun | 00 |
Keyboard ID | 83AB |
BAT Completion Code | AA |
BAT Failure Code | FC |
Echo | EE |
Acknowledge (ACK) | FA |
Resent | FE |
Keyboard Codes
Keyboard are available for several languages and settings. The keyboard that is most common for the English language is one with 104 keys. Keys of this keyboard are identified by numbers, and for every key there is a scan code. Several scan codes are available, and the default scan code is Scan Code 2 that will discuss here.Keyboard scan codes consist of a Make and a Break code. The Make code identifies the key pressed and the Break code identifies the release of a key. For most keys the Break code is F0 followed by the Make code. For example, when the Space bar (key 61) is pressed and released, hexadecimal codes 29, F0 and 29 are transmitted from the keyboard to the system via the data serial line. If this key remains pressed, the Make code (29) is continuously transmitted until it is released. Make codes for Scan Code 2 are shown in the table below.
Key Numb | Make Code | ASCII-No Shift | ASCII-Shift | Character-No Shift | Character-Shift |
---|---|---|---|---|---|
1 | 0E | 96 | 126 | ` | ~ |
2 | 16 | 49 | 33 | 1 | ! |
3 | 1E | 50 | 64 | 2 | @ |
4 | 26 | 51 | 35 | 3 | # |
5 | 25 | 52 | 36 | 4 | $ |
6 | 2E | 53 | 37 | 5 | % |
7 | 36 | 54 | 94 | 6 | ^ |
8 | 3D | 55 | 38 | 7 | & |
9 | 3E | 56 | 42 | 8 | * |
10 | 46 | 57 | 40 | 9 | ( |
11 | 45 | 48 | 41 | 0 | ) |
12 | 4E | 45 | 95 | - | _ |
13 | 55 | 61 | 43 | = | + |
14 | 66 | 08 | 08 | BS | BS |
15 | 0D | 09 | 09 | Tab | Tab |
16 | 15 | 81 | 113 | Q | q |
17 | 1D | 87 | 119 | W | w |
18 | 24 | 69 | 101 | E | e |
19 | 2D | 82 | 114 | R | r |
20 | 2C | 84 | 116 | T | t |
21 | 35 | 89 | 121 | Y | y |
22 | 3C/td> | 85 | 117 | U | u |
23 | 43 | 73 | 105 | I | i |
24 | 44 | 79 | 111 | O | o |
25 | 4D | 80 | 112 | P | p |
26 | 54 | 91 | 123 | [ | { |
27 | 5B | 93 | 125 | ] | } |
28 | 5D | 92 | 124 | \ | | |
29 | 58 | Caps | Caps | ||
30 | 1C | 65 | 97 | A | a |
31 | 1B | 83 | 115 | S | s |
32 | 23 | 68 | 100 | D | d |
33 | 2B | 70 | 102 | F | f |
34 | 34 | 71 | 103 | G | g |
35 | 33 | 72 | 104 | H | h |
36 | 3B | 74 | 106 | J | j |
37 | 42 | 75 | 107 | K | k |
38 | 4B | 76 | 108 | L | l |
39 | 4C | 59 | 58 | ; | : |
40 | 52 | 39 | 34 | ' | " |
41 | 5D | ||||
42 | 5A | 13 | Enter | Enter | Enter |
43 | 12 | Shift | Shift | Shift | |
44 | 61 | 58 | |||
45 | 1A | 90 | 122 | Z | z |
46 | 22 | 88 | 120 | X | x |
47 | 21 | 67 | 99 | C | c |
48 | 2A | 86 | 118 | V | v |
49 | 32 | 66 | 98 | B | b |
50 | 31 | 78 | 110 | N | n |
51 | 3A | 77 | 109 | M | m |
52 | 41 | 44 | 60 | , | < |
53 | 49 | 46 | 62 | . | > |
54 | 4A | 47 | 63 | / | ? |
55 | 59 | Shift | Shift | ||
56 | 14 | Ctrl | Ctrl | ||
57 | E01F | Win | Win | ||
58 | 11 | Alt | Alt | ||
59 | 29 | 32 | 32 | Space | Space |
60 | E0/11 | Alt | Alt | ||
61 | E027 | Win | Win | ||
62 | E0/14 | Ctrl | Ctrl | ||
63 | E02F | Menu | Menu |
The Make and Break arrangement, makes it possible for the system to identify multiple keys pressed and the order in which they have been pressed. For example, if one presses and holds down the Left-Shift key (key number 44), 12 Hex is continuously sent to the system. While this is happening, if key number 9 (the 8/* key) is pressed and released, 3E, F0 and 3E codes are transmitted. The receiving system identifies this sequence of events as the intention to enter an asterisk (*).
References:
- Digital Design and Implementation with Field Programmable Devices, Zainalabedin Navabi, Kluwer Academic Plubishers, 2005.
- www.acces-is.com (source of image)
No comments:
Post a Comment