Keyboard Protocols
- Updated
This is a preview of upcoming Admiral Shark's Keyboards content. This page is considered work-in-progress and should be treated as such.
Contents
IBM PC Mode 1
This is the line protocol for the original IBM Personal Computer series (5150, 5155 and 5160) keyboard interface introduced in 1981. Due to its use with the aforementioned IBM 5160 (Personal Computer XT), this protocol may be nicknamed the "XT protocol". It originally wasn't named "Mode 1", but it assumed that name after the introduction of Mode 2 and the distinction between them for IBM PS/2 Enhanced Keyboards. It's a serial protocol with a 9-bit data stream size.
- An inactive signal (logical 0) can be between +0V and +0.7V[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17]. - An active signal (logical 1) can be between +2.4V and +5.5V[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
- Mode 1 exclusively uses IBM scancode set 1.
System-to-keyboard
Hex | Function | Description |
---|---|---|
FF | Reset | Asks the keyboard to reset itself |
Auto-sense accessing (for IBM PS/2 Enhanced Keyboards)
IBM PC Mode 2
This is the line protocol for the IBM Display Station (315X, 316X, 3179, 3180, 319X, 347X and 348X), IBM Personal Computer AT (5170) and IBM Personal System/2 family keyboard interface. It was originally introduced with the IBM 3270 Personal Computer in October 1983, an IBM 3270 terminal emulation PC based around an IBM PC/XT that normally supports only Mode 1 keyboards but has an ISA-based Keyboard/Timer Adapter card that interfaces the Mode 2 based IBM 3270 Personal Computer Converged Keyboard with the system. It became PC industry's primary keyboard interface soon after, only surpassed by the rise of USB HID. It's a serial protocol with a 11-bit data stream size. There were three variants with differing levels of scancode and command implementation:
- The "terminal" variant introduced with the aforementioned IBM 3270 Personal Computer Converged Keyboard in October 1983 and reused with many IBM Display Stations with Type 2 104-key Model F Converged Keyboards, 122-key Model F and Model M (Types 1 through 3) Converged Keyboards, and terminal Enhanced Keyboard variants.
- The "AT" variant introduced with the IBM Personal Computer AT Keyboard in August 1984.
- The "Enhanced" variant introduced with the IBM 7531/7532 Industrial Computer Keyboard in May 1985 and reused with all PC-compatible Enhanced Keyboard variants. Due the Enhanced Keyboard's association with the IBM Personal System/2 PC family, it may also be called the "PS/2 protocol" or "PS/2 variant" as well.
- An inactive signal (logical 0) can be between +0V and +0.7V[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17]. - An active signal (logical 1) can be between +2.4V and +5.5V[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
- The "terminal" Mode 2 variant or compatible exclusively uses IBM scancode set 3.
- The "AT" Mode 2 variant exclusively uses IBM scancode set 2.
- The "Enhanced" Mode 2 variant can use IBM scancode sets 1, 2 or 3 but typically defaults to 2 for PC/AT compatibility.
System-to-keyboard
EF
and F1
are noted in the some documentation but as "invalid commands"[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17]..
Select Alternate Scan Codes (IBM PC Mode 2)
For "Enhanced" variant of IBM PC Mode 2 only
This system-to-keyboard command (F0
) is used to get or set the keyboard's current IBM scancode set (1, 2 or 3).
Getting sequence
TODO.
Setting sequence
F0
is sent from the system to begin the command sequence.- ACK is returned from the keyboard.
01
(set 1),02
(set 2) or03
(set 3) is sent from the system to specify which IBM scancode set to use.- ACK is returned from the keyboard, which then switches to the specified IBM scancode set.
Set/Reset Mode Indicators (IBM PC Mode 2)
For "AT" and "Enhanced" variants of IBM PC Mode 2 only
This system-to-keyboard command (ED
) is used to set or reset mode indicators (lock-light LEDs; Num Lock, Caps Lock and Scroll Lock).
Setting sequence
ED
is sent from the system to begin the command sequence.- ACK is returned from the keyboard and it stops scanning for keys if it was previously enabled.
- An 8-bit response is sent from the system to specify the status of each mode indicator. Bits 0 (Scroll Lock LED), 1 (Num Lock LED) and 2 (Caps Lock LED) can be set to 1 (on) or 0 (off), and bits 3 through 7 are reserved but must be set to 0.
- ACK is returned from the keyboard, which then configures the LEDs as specified and will re-enable scanning if the keyboard was previously enabled.
External
- IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
- Andries Brouwer - 12. Keyboard commands [accessed 2024-09-17].