PS / 2 interface

from Wikipedia, the free encyclopedia
PS / 2 sockets of a PC (mouse, green; keyboard, purple)

The PS / 2 interface ( PS / 2 connection , PS / 2 port , originally Auxiliary Port ) was a widely used serial interface for input devices ; mostly a keyboard and mouse , more rarely other pointing devices such as a trackball or a graphics tablet, were connected. It has been used in personal computers , for example , but it has been almost completely replaced by USB .


Initially, the PS / 2 interface was only found on computers of the RS / 6000 and PS / 2 series (hence the name) from IBM and was of little importance. After the end of the Personal System / 2 series, however, the company continued the IBM PC series and now also used PS / 2 connections for the input devices. This enabled the PS / 2 connection to establish itself on the PC replica market and increasingly appeared in the late 1990s with the introduction of the ATX standard for motherboards . Later versions of the ATX standard defined the color of the connectors. Even Hewlett-Packard used it for the HP 9000 , as did Digital Equipment Corporation for some terminals .


Dual adapter for connecting PS / 2 keyboard / mouse to the USB port on the PC
Active dual adapter for connecting USB keyboard / mouse to the PS / 2 interfaces on the PC

The adapters from or to USB that are included with many mice and some keyboards are purely passive adapters for adapting the connector standard or shape; Connected devices must distinguish on the basis of the signal level whether they are connected to a USB or PS / 2 interface, and behave accordingly. A non-USB PS / 2 device will not work with these adapters any more than a non-PS / 2 USB device.

A typical feature of an active PS / 2 USB adapter, to which pure PS / 2 keyboards that do not support the USB standard can also be connected, is electronics that are additionally present in a housing, which actively implement the protocols from PS / 2 on USB. Most active adapters also offer two PS / 2 ports, one each for a mouse and keyboard. Such adapters can be a bit more expensive than very cheap keyboards and mice, but are still a worthwhile option for operating high-quality PS / 2 keyboards on computers that have USB, but no PS / 2 connections.

In addition, there are also USB-PS / 2 adapters that are active in the opposite direction, also with additional electronics, to which a USB keyboard and a USB mouse can be plugged that do not support the PS / 2 standard. This makes it possible to operate newer USB keyboards or USB mice on older computers with a PS / 2 interface.


The PS / 2 interface uses a six-pin mini-DIN connector , while the keyboard interface in the previous AT format was equipped with the larger five-pin DIN connector . Both connections are identical in terms of electrical properties, so that keyboards with DIN plugs can be connected to the PS / 2 interface via a simple adapter cable or wired adapter and vice versa. The only exception is the older XT keyboard (from the time of the IBM PC XT ), which uses the same connector shape as the AT, but is electrically neither compatible with the PS / 2 nor the AT interface. Some older keyboards have therefore built-in switches. In the AT format, mice were usually connected via the RS-232 interface.

For desktop PCs usually two PS / 2 connectors are provided, one for mouse (or other pointing device) and keyboard. Although they have the same connector and even the same pin assignment, different protocols are used for the mouse and keyboard, so that the connectors must not be interchanged for correct functioning of the respective input device. Due to the electrically identical connection properties, there is generally no risk of hardware damage if accidentally mixed up. The connections are usually color-coded from the end of the 90s; the keyboard has purple plugs and sockets, respectively, and the mouse green. The colors are specified in the PC 99 System Design Guide from Intel and Microsoft . This is no longer to be found in your PC 2001 System Design Guide . These and other leading manufacturers recommended the USB alternative as early as the late 1990s .

On the other hand, notebooks and some compact industrial PC main boards only had a PS / 2 socket, which is almost always suitable for a mouse and keyboard and - except for very old models - can also be used for both at the same time with a special Y-cable can. The mouse and keyboard differ in their behavior when switched on and when they are reset, so that the notebook can distinguish between the two when they are connected directly. In order to be able to connect them to a PS / 2 socket at the same time, the two otherwise unused pins in the socket are used as additional clock and data lines. The Y-cable connects +5 V and GND of the connector (notebook) with both couplings, and a pair of clock and data lines each with a coupling. So all contacts are not simply switched in parallel, otherwise the mouse and keyboard would block each other.

Some manufacturers have also used the free pins for other purposes, for example to design a mouse for combined operation on PS / 2 and RS-232 or to switch on the PC with an additional key on the keyboard. This can lead to problems with certain combinations of computers and mice or keyboards.

In most current PC systems, the manufacturers have given up the PS / 2 interface in favor of the hot-plug USB. For old operating systems, the BIOS continues to emulate the PS / 2 interface more or less well, even if the mouse and keyboard are actually connected via USB.

Electrical interface

Pin assignment (view of the socket)

The physical interface of the PS / 2 interface is identical to that of the AT and MF2 keyboards. It has similar to the I 2 C interface a data line Data and a clock line clock . The levels on these lines are approximately 5 V. As you can see in the diagrams or the circuit diagram, each participant can actively pull the data or clock line to low. The high level is implemented passively through a pull-up resistor on both clock and data (in this example 4.7 kOhm). To avoid a data collision, each participant must check whether another participant is pulling the same deactivated line = high, open low= active during the transmission . The level low= active is thus dominant compared to the level high= passive .

The interface is not intended for hot plugging , i.e. plugging in during operation, neither the protocol nor the connectors allow this.


Principle circuit diagram of the PS2 interface

As the articles Scancode or Keyboard already describe, the protocol of a PC / XT keyboard is different than the historical predecessor of the other keyboards. Only the currently used protocol of an MF2 keyboard (AT keyboard) is described here.

Clock Data description
1 1 PC is ready to receive data from the keyboard.
1 0 The PC uses the start bit to indicate that it wants to send data to the keyboard.
0 1 PC is busy and cannot receive anything at the moment.
0 0 PC is being reset.

Basically, the clock comes from the keyboard, both for sending data to the PC and for receiving data from the PC. The frequency can fluctuate considerably as the clock is generated by software in the keyboard's microcontroller. The communication between keyboard and PC is only bidirectional via two lines ( data and clock ) . So basically only four different initial states are possible.

If the PC pulls the clock line low at any point in time, the keyboard must immediately interrupt any transmission that is in progress and only start again when the clock line is released. Unfortunately, many keyboards ignore this, which often leads to problems with adapters and KVM switches.

In the diagrams, the transitions are drawn as flanks to make the course easier to see. If you take it very carefully, the transition from highto happens lowalmost abruptly (through the low-resistance transistor). The transition from lowto high, on the other hand, is rather slow and follows the form of an exponential function (RC element made up of bus / line capacitances and pull-up resistance).

Diagram PS2 interface: data from KBD

The first diagram shows the history of the data shortly after the computer was switched on. In this example a BAT = $ AA is sent from the keyboard.

  1. As soon as the computer is switched on, clock and data are drawn from the PC low. The keyboard recognizes this and carries out a self-test (basic assurance test) .
  2. After the software in the PC has carried out an initialization (basic setting of all necessary peripheral components), data is initially no longer pulled low by the PC. If the PC is now ready to receive, the clock is also deactivated and opens due to the pull-up resistor high.
  3. Now that there are clock and data high , the keyboard can send data. The pause in this state is shown here shortened for reasons of space.
  4. First, the keyboard attracts Data on low(start bit) to the beginning to identify a byte to be transferred. After that, the keyboard will pull the clock on for a while low.
  5. The following data bits D0...D7, odd Parityand Stopbit( Data = 1) are transmitted in the same way . In the example is D7...D0 = 1010 1010which $AA = BATcorresponds. Since the number of ones contained is even, the parity bit is odd Parityset for.
  6. At the end of the stop bit, data and clock are both again high.
  7. To confirm the received data, the PC sets Clock on low, until the internal processing completed.
Diagram PS2 interface: data from the PC
  1. First of all, the PC clock must be deactivated again (negative True Logic) so that a transmission is possible. Shortly afterwards the PC hangs up data in loworder to signal a transfer request with the start bit.
  2. Once the keyboard has recognized the start bit, it puts on the clock to lowrequest the next bit.
  3. Now the data bits D0...D7, Parityand follow the Stopbitsame pattern. Here in the example is 1110 1101 = $ED = Set LEDsending.
  4. While the clock is still in the stop bit high, the keyboard applies data to the bit level for acknowledgment lowand then applies the clock for a while low.
  5. After that, Data is taken back from the keyboard, and both Data and Clock are high.
  6. Finally the PC clock starts up again to lowprocess the data.

After this command Set LED, the keyboard would Ackacknowledge the command as 'understood' at byte level. Next, the PC can then $02transfer the parameter , for example ( NumLock-LED an). The command overview is under Scancode .

Web links

Commons : PS / 2 interface  - album with pictures, videos and audio files

Individual evidence

  1. Network PC System Design Guidelines (PDF; 481 kB) Intel. August 5, 1997. Retrieved May 28, 2011.
  2. PS / 2 hot plugging . c't (issue 9/2004). 2004. Retrieved February 13, 2012.