Team LiB   Previous Section   Next Section

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 current production AT and BAT motherboards. 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
figs/pcn2_1901.gif

Table 19-1. AT keyboard interface signals and pinout

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

The pin descriptions are self-explanatory, other than pin 3. The 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 fifteen 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
figs/pcn2_1902.gif

Table 19-2. PS/2 keyboard interface signals and pinout

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

The AT and PS/2 keyboard interfaces use incompatible connectors, but 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.

Table 19-3. Pinouts for an AT-to-PS/2 or PS/2-to-AT adapter

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 recent keyboards can be connected to a USB port. For now at least, few keyboards are USB-only. 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, like Windows 98/98SE/Me or Windows 2000/XP, 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.

Our USB keyboard experience, which to date is limited to casual testing with Windows 98/2000, suggests that USB-only keyboards are not ready for prime time. Testing several systems—all with the most recent BIOS updates available—with several USB keyboards, we have experienced numerous lockups and other weirdities, including situations where the PC continued to run normally but the keyboard was no longer recognized. We recommend using the PS/2 interface rather than USB until the bugs are worked out.

    Team LiB   Previous Section   Next Section