Handy Board Servo Routines
Run Two Servo Motors at Once!
Routines are now available to drive two simultaneous, independently controlled servo motors from the Handy Board!The routines generate output signals on Port A bit 7 and Port A bit 5. The former of these is the place that the old servo routine generated its output. The latter is a pin that is open and available on the HB Expansion Bus.
The routines provide a primitive but functional interface for controlling the position of the servo. For each servo, a global variable is set, generating a specific pulse train which acts as a desired position input to the servo. In order to make the servo "sweep," one must write C code to iterate values over the position global.
For maximum flexibility, the routines do not provide a "sanity check" to validate the value of the global being in a usable portion of the servo's range. For a typical servo, valid values range from 400 to 4800 (yielding pulse times of 0.2 to 2.4 milliseconds). Value outside of this range will cause the servo to overtax itself as it tries to reach a position that is not mechanically possible. You may wish to write your own wrapper functions for setting the control globals and rejecting out-of-bounds values.
Another alternative is to use the Handy Board's own 9.6v battery with a string of several 1N4001 diodes to drop the voltage down to around 6 volts. The 9.6v output is either of the two left-most pins of the four-pin connector header directly above the BATT/PWR LED's.
The ground for the servo leads (black wire) should connect to the Handy Board's motor ground, not its logic ground. The motor ground is either of the two right-most pins of the four-pin connector header directly above the BATT/PWR LED's.
The servo signal lead (white wire) connects to specific Handy Board digital outputs as described later.
The two drivers (servo_a7.icb and servo_a5.icb) must be loaded into IC, either at the command line or via a .lis file. The drivers may be loaded individually or together.
Each driver declares a global variable for setting the servo position and an initialization routine for turning the servo on and off.
The servo control signal is generated on Port A bit 7, which is brought out as digital "input" 9 on the HB connector bank (this input line is converted to an output when driving the servo).
The default value of this global is 2560, which is re-established on board reset.
The default value of this global is 2560, which is re-established on board reset.