Last modified on 8 January 2010, at 17:53

Serial RS232 Mouse

Revision as of 17:53, 8 January 2010 by Nocash (Talk | contribs)

Serial RS232 mice could be connected to RS232 interfaces, such like the Amstrad Serial Interface, or to other (in-)compatible Serial interfaces (see Peripherals for a complete list of known Serial interfaces).

With their hardware based motion-counters, these mice would give much better resolution (5120 mickeys/second) (forty 3-byte packets/second) than the AMX Mouse (300 mickeys/second). Another approach to use a RS232 mouse would be a mouse interface like the AMX Kit, though that'd cripple the resolution to the AMX level.

Standard Serial Mouse (most common)

A serial mouse should be read at 1200 bauds, 7 data bits, no parity, 1 stop bit (7N1) with DTR and RTS on. For best compatibility, the mouse should output 2 stop bits (so it could be alternately also read as 7N2 or 8N1). When the mouse gets moved, or when a button gets pressed/released, the mouse sends 3 or 4 characters:

 __First Character____________________
 6    First Character Flag (1)
 5    Left Button  (1=Pressed)
 4    Right Button (1=Pressed)
 2-3  Upper 2bit of Vertical Motion
 0-1  Upper 2bit of Horizontal Motion
 __Second Character___________________
 6    Non-first Character Flag (0)
 5-0  Lower 6bit of Horizontal Motion
 __Third Character____________________
 6    Non-first Character Flag (0)
 5-0  Lower 6bit of Vertical Motion
 __Fourth Character (if any)__________
 6    Non-first Character Flag (0)
 5    Middle Button (1=Pressed)
 4    Unused ???
 3-0  Wheel  ???

Additionally, the mouse outputs a detection character (when switching RTS (or DTR?) off and on:

 "M" = Two-Button Mouse (aka "Microsoft" mouse)
 "3" = Three-Button Mouse (aka "Logitech" mouse)
 "Z" = Mouse-Wheel

Normally, the detection response consist of a single character (usually "M"), though some mice have the "M" followed by 11 additional characters of garbage or version information (these extra characters have bit6=0, so after detection, one should ignore all characters until receiving the first data character with bit6=1).

Mouse Systems Serial Mouse (rare)

Accessed at 1200 bauds, just like standard serial mouse, but with 8N1 instead 7N1, and with different data bytes.

 __First Byte_________________________
 7-3  First Byte Code (10000b)
 2    Left? Button   (0=Pressed)
 1    Middle? Button (0=Pressed)
 0    Right? Button  (0=Pressed)
 __Second Byte________________________
 7-0  Horizontal Motion (X1)
 __Third Byte_________________________
 7-0  Vertical Motion   (Y1)
 __Fourth Byte________________________
 7-0  Horizontal Motion (X2)
 __Fifth Byte_________________________
 7-0  Vertical Motion   (Y2)

The strange duplicated 8bit motion values are usually simply added together, ie. X=X1+X2 and Y=Y1+Y2, producing 9bit motion values.

Notes

Mice do return raw mickeys, so effects like double speed threshold must (should) be implemented by software.