donderdag 13 november 2008

Servo controller software

The software for the servo controller is simple: it initializes the analog input AN0, it ensures that the internal clock is running at 8 MHz, and sets the servo motor port to output. The main loop then reads the value of the potentiometer using the ReadPotentiometer routine, and calls DoThisNow to start the pulse on the servo motor control that will cause it to move to the correct position. A servo motor expects a 1ms pulse that is on, then 0-1ms that is on (which determines the position) and finally at least 20ms of offtime. It can therefore change 50x each second, however, it is usually slower in responding.

The software implementation allows a value from 1-511 to define the second 1ms, thereby having a good resolution. A final version of this software would allow storing the values from the potentiometer in either internal EEPROM or external memory, thereby allowing you to replay it. It should also allow for multiple servo controllers. An example of this is my older version of servo controller software, which stores the different settings using macros in program memory, allowing easy control using POSITION and LINEAR macros. This was the version used by balloon manor in 2007 in Rochester, NY.

Geen opmerkingen: