I'm going about the job of interfacing a PS/2 mouse to my AVR micro - so this will be a work in progress kind of job. This is something that millions have done before, but by doing this from scratch, I hope to not only mess it up, but also have fun.
1. Get a mouse, and a 6-pin mini-din female (so we can just plug in) - the mouse needs power, and just 2 data lines, CLK and DATA
2. The system is bi-directional, so to read we configure the pin as an input, and to write we either force the pin low, or 'pull' it high using the built-in pull-up resistance. 11 bits are sent serially: a start (0), 8 data, odd parity and a stop (1).
3. Next we need to send it some commands - the mouse will acknowledge the init command, and thereafter sends 3 bytes every time we send the "read" command.
4. The protocol http://www.computer-engineering.org/ps2mouse/
5. Example arduino sketch showing how to dive the 2 pins needed http://arduino.cc/playground/ComponentLib/Ps2mouse
6. Accurate timing data appears hard to get... 10-16.7 kHz makes it 1/10000 = 10us-6us clock. Some better data was found here : http://www.networktechinc.com/ps2-prots.html a bit of deeper investigation seems to indicate that the device (as opposed to host) needs a few cycles just to catch up every few bits - so 10us probably works out at closer to 25us
Installing AVR Studio
Atmel's new IDE is based on Microsoft Visual Studio 2010, so if like me you are equally at home using programmers notepad or Visual Studio, you should be up and running quickly. Download the new 5.1 version from Atmel download site. It's about 550mb, so it will take a long time.
AVR Studio 5.1 direct links - this bypasses the registration step, and only works if you have already registered. Small download (without runtimes) or the full download (includes .NET runtimes and Visual Studio basis) . And no, it does not include a free copy of Visual Studio 2010, it's just the C/C++ editor, and the Atmel toolchain plus debugger all in one tidy box.
MS call this their language shell, you get the same file and project management features, windows and toolbars, but the compiler and debugger get replaced with Atmel ones. Probably wired a bit like the Android SDK is into Eclipse, which I never really caught onto for lack of desire to learn Java at the time. Partly I was put off Eclipse as a stable platfom after a bad experience with Carbide for Symbian; which was actually fun to learn in the end. So there you have it, AVR studio plays nicely with your existing ISP or debugger hardware all in one UI.
Talking the Fork
6 days ago