Interfacing With A PS/2 Mouse

[David] sent in his implementation of reading a PS/2 mouse with a PIC microcontroller and some LED displays. Of course, this follows hot on the heels of using a PIC with a PS/2 keyboard so now might be the time to start digging out your old peripherals out of your junk pile.

[David] began his project trying to figure out how to connect a mouse to his breadboard. After hacking the plastic off a PS/2 mouse extension cord, he wired everything up according to the pinout. Programming the PIC to understand PS/2 commands was a little strange. [David] is used to having his microcontrollers provide the clock signal. The PS/2 protocol is a bit strange as the peripheral sets the clock. Since PS/2 is a bidirectional protocol, the mouse also accepts commands. The host – [David]’s PIC – must send the mouse a command to start sending movement data.

Because USB keyboards and mice are backwards compatible with PS/2 ports, [David] tried out a few USB mice with a USB to PS/2 adapter. Every attempt at using a USB mouse failed. Strangely, when a Bluetooth mouse was tried (via Bluetooth to USB to PS/2), everything worked perfectly. Check out [David]’s PIC mouse demo after the break.

Continue reading “Interfacing With A PS/2 Mouse”