In this section we will place articles about useful hardware tools and tutorials on how to use them. Maybe it sounds simple, but for many tools most people could use some advice on how to use them. Also you will find some tools you did not even know they exist and they can make your life easier.
In this example we give you complete project for AVR readout of PS2 mouse position. Complete code is well commented and available for download on link below. To understand command format and register meaning, see details in The PS/2 Mouse Interface article .
The code is written for ATmega8535, but can be very easily adjusted for any microcontroller. All interaction with mouse is managed in while(1) loop. Very interesting application of this project would be attempt to make robot navigation using simple and very cheap PS2 or USB optical mouse for encoder purposes. Of course, you can allways use mouse in conventional way for some kind of menu or position navigation and control of your device. Maybe for your implementation of robot arm.. Use your creativity.
In this example we read all mouse registers using function loop1(). These registers are:
This article attempts to explain every aspect of the PS/2 mouse interface including the physical and electrical interface, low-level protocol, modes of operation, commands, and extensions.It is exelent article to get details on mouse register meaning and commands format. I recoment you to read it before you start example for AVR PS2 mouse readout.
In this article is given detailed explanation of PS/2 hardware and protocol details for communication with PS/2 devices. Those devices are usually mouses and keyboards. If you want quick start example for microcontroller keyboard key readout with full AVR codevision project provided, check out AVR - PS/2 keyboard key readout article and in here you have PS/2 mouse AVR microcontroller readout exaple with complete source code and video presentation.