PS2 ports use synchronous serial signals to communicate between the keyboard or mouse to the computer
6 pin MINI-DIN MALE (PS/2 STYLE) connector at the computer
|PS2 ports use synchronous serial signals to communicate between the
keyboard or mouse to the computer. The signals are all TTL logic level
voltages (0 volts for logical 0 and +5 volts for logical 1).
Bi-directional communications are supported on all PS2 ports (mostly for
keyboards but may be implemented in mouse only ports), all
bi-directional transmissions are controlled by the clock and data lines.
This feature is controlled by an open collector architecture which lets
both lines to be forced to logical 0 by the device (mouse or keyboard)
or the host computer. This means that at any point in time the host can
force the clock line to 0 and inhibit the mouse to transmit. If the host
inhibits while the mouse is transmitting the transmitted data must be
retransmitted. Although this may seem odd, both ports are usually
controlled by an INTEL 8042 keyboard controller (yes the keyboard
controller also controls the PS2 mouse port on it's second channel).|
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).
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 ADAPTERSMany 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.
DataMouse data packets or keyboard scan codes are sent from the mouse or keyboard to the computer on this single wire serially.
ClockThis signal is sent from the mouse or keyboard to synchronise the data signal.
+5 VdcThis is a simple 5 volts signal for giving power to the mouse or keyboard.
GroundThis is a common ground signal used as a return path for data and is a reference to logical 0.
Note: Direction is Computer relative Mouse.