Data Interface

Just about all mice in use today have PS/2 type connectors, as shown here:


A typical PS/2 Connector. Assume that pin 1 is
located just to the left of the black alignment pin
and the others are numbered clockwise from there.

These pins have the following functions (refer to the above photo for pin numbering):

  1. Unused
  2. +5 volts (to power the chip and LEDs)
  3. Unused
  4. Clock
  5. Ground
  6. Data
Whenever the mouse moves or the user clicks a button, the mouse sends three bytes of data to the computer. The first byte's 8 bits contain:
  1. Left button state (0 = off, 1 = on)
  2. Right button state (0 = off, 1 = on)
  3. 0
  4. 1
  5. X direction (positive or negative)
  6. Y direction
  7. X overflow (the mouse moved more than 255 pulses in 1/40th of a second)
  8. Y overflow
The next two bytes contain the X and Y movement values respectively. These two bytes contain the number of pulses that have been detected in the X and Y direction since the last packet was sent.

The data is sent from the mouse to the computer serially on the data line, with the clock line pulsing to tell the computer where each bit starts and stops. 11 bits are sent for each byte (1 start bit, 8 data bits, 1 parity bit and 1 stop bit). The PS/2 mouse sends on the order of 1,200 bits per second. That allows it to report mouse position to the computer at a maximum rate of about 40 reports per second. If you are moving the mouse very rapidly, the mouse may travel an inch or more in 1/40th of a second. This is why there is a byte allocated for X and Y motion in the data protocol.

 
 

 

 

1