Aquarium CB 21MHz Electronics Music Photos ZX Spectrum +2A Cooking Fishing Main page Aquarium CB 27MHz Electronics Music Fotos ZX Spectrum Cooking Fishing
Česká verze

PC mouse


PC mouse This page describes a communication and connection between two and three button mouse and Personal Computer. The coding of two-button mouse (Microsoft Mouse) differs from the coding of three-button mouse (Mouse System Mouse) and both is described. All time diagrams are scanned by logic analysator. A literature of this problematic wasn't reachable for me.


Connection

A standard serial interface RS232 with 9 or 25 pin Cannon connectors is used. For placement of signals see Fig.4.1.1.

Mouse connector
Fig. 4.1.1. Placement of signals on connectors

A mouse is connected with PC by four wires. Old types of mouses used in addition signal DTR. But it is history. Power supply is provided by signal TXD, which is set to log.1 (-12V). RTS signal serves for mouse initialization and RXD signal serves for data transmission to PC. If RTS signal is in log.1 state (-12V) then the mouse is inicialized and starts to work only after log.0 state (+12V) on this pin. The communication protocol is 8 bit word with one start and one stop bit by velocity 1200Bd.

Communication protocol of 2 button mouse (Microsoft Mouse)

This mouse is sending on every event (movement or pushing a button) three bytes. The first one is about the movement direction and button's state. The second and third one are about the value of this movement in X and Y axe. After initialization by RTS signal the mouse sends one byte ($CD). This fact could be used for detection of connected type of mouse.

Data MS mouse
Fig. 4.2.1. Communication bytes of two button mouse

In next table are these bytes described.

byte bit purpose
1. 0.-1. direction X (00 ... right, 11 ... left)
2.-3. direction Y (00 ... down, 11 ... up)
4. right button (0 ... OFF, 1 ... ON)
5. left button (0 ... OFF, 1 ... ON)
6.-7. always 11
2. 0.-5. direction X difference (-32..31)
6. always 0
7. always 1
3. 0.-5. direction Y difference (-32..31)
6. always 0
7. always 1

Communication protocol of 3 button mouse (Mouse System Mouse)

This mouse is sending on every event (movement or pushing a button) five bytes. The first one is about the button's state. The second and third ones are about the value of this movement in X and Y axe.The fourth and fifth one are about the value of velocity of this movement in X and Y axe. After initialization by RTS signal the mouse sends NOTHING.

Data 3 tl. myši
Fig. 4.3.1. Communication bytes of three button mouse

In next table are these bytes described.

byte bit purpose
1. 0. right button (1 ... OFF, 0 ... ON)
1. middle button (1 ... OFF, 0 ... ON)
2. left button (1 ... OFF, 0 ... ON)
3.-6. always 0
7. always 1
2. 0.-7. direction X difference (-128..127)
3. 0.-7. direction Y difference (-128..127)
4. 0.-7. direction X difference velocity (-128..127)
5. 0.-7. direction Y difference velocity (-128..127)


All the best and good luck from Petr Simandl
p21s@hotmail.com
Main page

Last change : 10.7.1999