Hardware pinouts information and cables schemes

Mouse (PS/2) pinout

connector or cable wiring scheme

bookmark this page

PS2 ports use synchronous serial signals to communicate between the keyboard or mouse to the computer




Data transmission from the mouse to the computer is done as in figure 1, each clock period is usually between 70 to 150 microseconds (10 to 25 microseconds for transitions and 30 to 50 microseconds for high or low state), some may feel that these are large margins both this works good since this is a synchronous port (this also helps cut on the cost of high precision clocks). The data line transition is made on the falling edge of the clock signal and is usually sampled when the clock is low. Each data packet is composed of 11 bits, 1 start bit (which is low), 8 data bits, 1 odd parity bit and 1 stop bit (high).
Pin Name Dir Description
1DATA<->Key Data
2n/c-Not connected
3GND---Gnd
4VCC-->Power , +5 VDC
5CLK-->Clock
6n/c-Not connected
Note: Direction is Computer relative Mouse.

Data

Mouse data packets or keyboard scan codes are sent from the mouse or keyboard to the computer on this single wire serially.

Clock

This signal is sent from the mouse or keyboard to synchronise the data signal.

+5 Vdc

This is a simple 5 volts signal for giving power to the mouse or keyboard.

Ground

This is a common ground signal used as a return path for data and is a reference to logical 0.


When the PS2 mouse sends it"s information it must send 3 consecutive data packets in a row. Each packet sent has different information for button pressed, movement and direction of movement. The table below shows what information is sent in each packet. Please remember that this information is of general nature and can change from one manufacturer to another. This is for a 2 button mouse, I have no idea what bit is used for other types of mouses like 3 buttons and others that have special functions like an up-down wheel for scrolling within windows.

D7D6D5D4D3D2D1D0
1stYVXVYSXS10RL
2ndX7X6X5X4X3X2X1X0
3rdY7Y6Y5Y4Y3Y2Y1Y0

LLeft Button State (1 = pressed down)
RRight Button State (1 = pressed down)
X0-X7Movement in the X direction
Y0-Y7Movement in the Y direction
XSDirection of the movement in the X axis (1 = UP)
YSDirection of the movement in the Y axis (1 = LEFT)
XV,YVOverflow of the movement data bits (1 = overflow has occured)

The X and Y direction bits send the number of bits you moved since the last time this information was sent, the actual direction of the movement is sent in the XS and XY bits. If the movement of the mouse was higher than 255 data displacements since the information was last sent the overflow bit will go to one and will reset back to 0 as soon as the current data is sent. The way the driver handles overflow can change from one mouse driver to another, some may move the pointer 256 data bits and some may even decide to leave the pointer where it is! Some of you might wonder what exactly are the data bits sent for the movement bits, you will be able to shortly find this out in the i/o devices section on mouses which will be online shortly!

PS2 MOUSE ADAPTERS

Many of you have requested information on adapting serial mouses to PS2 ports and vice-versa. This is a very touchy subject and I wouldn"t recommend to anyone to go ahead and make these adapters. Most mouses are either built for PS2 or serial ports and some are built for both, in the later case the appropriate adapters are supplied with the mouse when you buy it or can be purchased as an option.
Because of the nature of the ports the two kinds of mouses are not directly compatible. They don"t send out the information in the same matter (different protocols) and don"t use the same signal levels, PS2 mouses uses TTL logic signals (0-5 volts) and serial mouses use RS232 signals (typically +10 volts - -10 volts). When a mouse is built for operation on both ports, are setup with a 9 pin D-Shell used in serial mouses, these connectors have 9 pins and the serial mouse only uses between 5 and 8 pins. This leaves us with at least 1 spare line, this is the line that the PS2 data portion of the mouse will use for sending it"s information. So as you can see, the adapters are designed to work on a particular make and model and are not usually compatible with other mouses.

Mouse resolution and tracking rate

The standard PS/2 mouse (with Logitech mouse) defaults to 160 CPI and can be switched to 40, 80, 160 or 320 CPI with software. Microsoft mouse driver for Windows 3.x and Windows 95 defauls to 160 couns per inch. The maximum tracking rate for PS/2 mouse is 40 report/second * 255 counts per report = 10200 counts per second. For 100 CPI mouse this would indicate maximum trackign rate of 102 inches per second and for 400 CPI mouse only 25.2 inches per second.

Bi-directional transmission is controlled by the CLK and DATA lines. Both are fed by an open collector device which lets either host or mouse force the line to "0". During non-transmission, CLK is at "1" and DATA can be at "0" or "1".

The host can inhibit mouse transmission by forcing CLK to "0". If the host inhibits the mouse while it is transmitting, the byte must be retransmitted (if the inhibit state arrived before the 11th clock).

There is a simple description in my old IBM PS/2 model 50/60 technical reference. The mouse interface is the same as the keyboard interface. The Intel 8042 supports two channels, one for keyboard and one for the auxiliary device (mouse, trackball, touchpad). Pin 1 is the data, pin3 ground, pin 4 +5V and pin 5 clock.

Receiving data: Check "clock". If inactive, there is a bit on the "data" line. Each transmission unit is one start bit, eight data bits, odd parity and one stop bit. Start bits are low, stop bits high. Each clock active or inactive period is 30 to 50 microseconds. Data transition to falling edge of clock is 5 to 25 microseconds.

Sending: Check that both clock and data are high. Pull down data for start bit, and start clocking.

NOTE: Logitech has made their own extension also to this protocol to allow three buttons.

Mouse movement detectors

The most tyical construction of mouse movement detectors are optomechanical detectors. The system works so that X and Y movement of the mouse rotates slotted disks. The movement info is then picked from those slotted disks using optical sensors. There are two sensors for each slotted disk and those sensors give out two singals which are 90 degreed out of phase compared to each other.


sensor #0 ----    ----    ----    ----   light
              ----    ----    ----       no light

sensor #1   ----    ----    ----    --   light
          --    ----    ----    ----    no light
So if we call the getting light phase "1", and the not getting light phase (when the light is blocked by the wheel) "0" then it looks like this:
sensor #0 - 1111000011110000111100001111
sensor #1 - 0011110000111100001111000011
            ^^^^^^^^
            full cycle of pulses
This can be decoded into four discrete bit pairs for the two sensors:
         Forward direction     Backwards direction
            0 1 2 3                3 2 1 0
sensor #0 - 1 1 0 0                0 0 1 1
sensor #1 - 0 1 1 0                0 1 1 0
This information can be easily decoded usign small microcontroller and then sent to computer in correct format.

Related Links:
Pinouts.ru > Input devices (keyboards, mices, joysticks) pinouts >  Pinout of Mouse (PS/2) and layout of 6 pin mini-DIN female (PS/2 STYLE) connector and 6 pin mini-DIN male (PS/2 STYLE) connector
Document status: correct
Source(s) of this and additional information: partially Tomi Engdahl and Gilles Ries 7 reports
Last updated at Sun Nov 25 2007. Submit additions or corrections for this document. Is this document correct or incorrect? What is your opinion?
[Discuss at the forum] [Back to index] [SUBMIT new pinout]
This page contain parts under Copyright © 2000-2007 by pinouts.ru team.
No any portion of this webpage may be reproduced in any form without visible direct link to this page provided. Webmaster permission required in any other cases.
Efforts have been made to ensure this page is correct, but it is the responsibility of the user to verify the data is correct for their application.
50075 hits since March 4, 2005