Skip to content

AT PS2 Command Set

Adam edited this page Nov 21, 2022 · 4 revisions

AT-PS/2 Command Set

The biggest difference between AT and XT keyboards is that the host can talk to the AT keyboard using bidirectional serial clock and data lines. Now that the host can talk to the keyboard; they used that to implement a short list of functions that was later expanded upon with PS/2 keyboards.

This adapter aims to support several of this functions though not all. It is worth noting that some keyboard controllers do not support every function and instead just mimics a keyboard acknowledge signal without talking to the keyboard.

Using this PDF as a reference: https://www.tayloredge.com/reference/Interface/atkeyboard.pdf Here is a list of the command set commands and whether or not they are supported by this adapter

Hex Description Implemented
0xFF Reset
Causes keyboard to enter "Reset" mode.
✔️
0xFE Resend
This is used to indicate an error in reception. Keyboard responds by resending the last scan code or command response sent to the host. However, 0xFE is never sent in response to a "Resend" command.
0xFD Set Key Type Make (PS/2 keyboards)
Allows the host to specify a key that is to send only make codes. This key will not send break codes or typematic repeat. This key is specified by its set 3 scan code.
0xFC Set Key Type Make/Break (PS/2 keyboards)
Similar to "Set Key Type Make", but both make codes and break codes are enabled (typematic is disabled.)
0xFB Set Key Type Typematic (PS/2 keyboards)
Similar to previous two commands, except make and typematic is enabled; break codes are disabled.
0xFA Set All Keys Typematic/Make/Break (PS/2 keyboards)
Default setting. Make codes, break codes, and typematic repeat enabled for all keys (except "Print Screen" key, which has no break code in sets 1 and 2.)
0xF9 Set All Keys Make (PS/2 keyboards)
Causes only make codes to be sent; break codes and typematic repeat are disabled for all keys.
0xF8 Set All Keys Make/Break (PS/2 keyboards)
Similar to previous two commands, except only typematic repeat is disabled.
0xF7 Set All Keys Typematic (PS/2 keyboards)
Similar to previous three commands, except only break codes are disabled. Make codes and typematic repeat are enabled.
✔️
0xF6 Set Default
Load default typematic rate/delay (10.9cps / 500ms), key types (all keys typematic/make/break), and scan code set (2).
✔️
0xF5 Disable
Keyboard stops scanning, loads default values (see "Set Default" command), and waits further instructions.
✔️
0xF4 Enable
Re-enables keyboard after disabled using previous command.
✔️
0xF3 Set Typematic Rate/Delay
Host follows this command with one argument byte that defines the typematic rate (CPS) and delay as follows:
(Note: the PDF linked above has this table backwards which is incorrect)
Bits 0->4 - CPS Bits 0->4 - CPS Bits 0->4 - CPS
00000 - 30.0
00001 - 26.7
00010 - 24.0
00011 - 21.8
00100 - 20.0
00101 - 18.5
00110 - 17.1
00111 - 16.0
01000 - 15.0
01001 - 13.3
01010 - 12.0
01011 - 10.9
01100 - 10.0
01101 - 9.2
01110 - 8.6
01111 - 8.0
10000 - 7.5
10001 - 6.7
10010 - 6.0
10011 - 5.5
10100 - 5.0
10101 - 4.6
10110 - 4.3
10111 - 4.0
11000 - 3.7
11001 - 3.3
11010 - 3.0
11011 - 2.7
11100 - 2.5
11101 - 2.3
11110 - 2.1
11111 - 2.0

Bits 5->6 Delay (seconds)
00b 0.25
01b 0.50
10b 0.75
11b 1.00
✔️
0xF2 Read ID (PS/2 keyboards)
The keyboard responds by sending a two-byte device ID of 0xAB, 0x83.
✔️
0xF0 Set Scan Code Set (PS/2 keyboards)
Host follows this command with one argument byte, that specifies which scan code set the keyboard should use. This argument byte may be 0x01, 0x02, or 0x03 to select scan code set 1, 2, or 3, respectively. You can get the current scan code set from the keyboard by sending this command with 0x00 as the argument byte.
✔️
0xEE Echo
The keyboard responds with "Echo" (0xEE).
✔️
0xED Set/Reset LEDs
The host follows this command with one argument byte, that specifies the state of the keyboard's Num Lock, Caps Lock, and Scroll Lock LEDs. This argument byte is defined as follows:
✔️
Clone this wiki locally