Tuning the PID values for the servo controller is going to mean getting an easier method of communication with the device.
At the moment, to adjust anything, I change a variable in the source code, recompile, and reflash the controller chip. Not easy for quick testing of a minor change. Especially, since it means removing the chip from the prototyping breadboard, inserting it into the development board for programming, and moving it back again for testing. Argh!
I am going to need data coming out to judge the performance of the controller (measure errors, etc). I am also going to need data going in to quickly adjust parameters. I had added some simple serial output (for a quick debug), but this will need better management as the system is quite timing critical (the current serial output routine blocks signal processing while it waits to send the bytes out).
A few quick adjustments saw the outbound data buffered and dispatched only when the UART is ready to accept it. An inbound buffer was also created for inbound commands. A simple set of commands were implemented, and now pressing "A" & "S" in a terminal window rotates the motor forward or backward 1 revolution (1/6th revolution for lower case). "Z" will return the motor to its "zero" position.
The controller now regularly outputs the current position, desired position, and output value. Before launching into PID tuning, I might run a few tests to check that the encoder decoding routines function accurately, etc. I'd like to test the control decoding, but I've just realised... I don't have a system with a parallel port!