19.3 Keyboard Interfaces
Keyboard
interfaces are well standardized, and have been for years. This means
that, with the exception of antique PC and PC/XT keyboards, you can
plug any keyboard into any PC to which it can physically connect and
expect it to work. The following sections detail the three keyboard
interfaces currently in use.
19.3.1 AT Keyboard Interface
The AT keyboard interface was
introduced with the IBM PC/AT in 1984, and is still used by the few
AT and BAT motherboards still being produced. AT keyboards use the
5-pin DIN connector (female at the PC), shown in Figure 19-1 and whose pinouts are described in Table 19-1. On the PC side, the AT keyboard uses an Intel
8042 or equivalent interface chip, which is assigned IRQ1 and I/O
base address 0060.
Figure 19-1. The AT keyboard connector

Pin | Signal name | Description |
---|---|---|
1 | CLOCK | Keyboard clock; open collector CLK, CTS |
2 | DATA | Keyboard data; open collector RxD/TxD, RTS |
3 | RESERVED | Reset (usually not connected) |
4 | GROUND | Signal ground |
5 | VCC | +5VDC |
83-key IBM PC/XT keyboard and some 84-key IBM PC/AT keyboards used an
early keyboard protocol that did not include a software reset
command. For these keyboards, the PC uses Pin 3 to send a hardware
reset to the keyboard. All systems and keyboards made in the last 15
years use a keyboard protocol that includes a software reset command,
and nearly all recent keyboards leave Pin 3 unconnected.
19.3.2 PS/2 Keyboard Interface
The PS/2 keyboard interface was
introduced with the IBM PS/2 series in 1986, and is now used by all
ATX and ATX-variant motherboards. PS/2 keyboards use the 6-pin
mini-DIN connector (female at the PC), shown in Figure 19-2 and whose pinouts are described in Table 19-2. On the PC side, the PS/2 keyboard uses the
same Intel 8042 or equivalent interface chip as the AT keyboard,
which is also assigned IRQ1 and I/O base address 0060.
Figure 19-2. The PS/2 keyboard connector

Pin | Signal name | Description |
---|---|---|
1 | DATA | Keyboard data |
2 | RESERVED | No connection |
3 | GROUND | Signal ground |
4 | VCC | +5VDC |
5 | CLOCK | Keyboard clock |
6 | RESERVED | No connection |
Shield | - | Ground |
are electrically and functionally identical. You can connect an AT
keyboard to a PS/2 keyboard port or vice versa by building or buying
an adapter that uses the pinouts listed in Table 19-3. Many new keyboards come with an adapter to
allow their use with the other style connector. Such adapters can
also be purchased at most computer stores.
PS/2 pin | AT pin | Description |
---|---|---|
1 | 2 | Keyboard data |
2 | 3 | No connection |
3 | 4 | Signal ground |
4 | 5 | +5VDC |
5 | 1 | Keyboard clock |
6 | - | No connection |
19.3.3 USB Keyboard Interface
Some keyboards can be connected to a
USB port. Most USB-capable keyboards also provide a standard PS/2
connector, via either a split cable with both USB and PS/2 connectors
or a separate adapter that converts the USB connector to PS/2. To use
a USB keyboard, the PC BIOS must support USB keyboards,
and you must run an operating system, such as
Windows 9X/2000/XP or Linux, that supports USB. BIOS support is
needed so that the keyboard can be used before the operating system
loads to do such things as changing Setup parameters or choosing
options from a boot menu. Operating system support is required for
the keyboard to be accessible after the system boots.