Listing 3—The servo timing is generated by the servo interrupt service routine, which is called once per tick. It simply generates pulses of programmable duration on the parallel port. Each channel is actuated in sequence, which generates a pulse train of 1.5 ms × 12, or 18 ms, on average. The pulse rate is not critical and varies between 10 and 25 ms, but the pulse width has to be precise to set the positions of the actuators.

int SetTime[nCHAN];	/* value for timer */
int Ticks;	/* value for current output */
int CurrChan;	/* current channel */

Servo_Isr() {	/* only do something when we run out of ticks */
  if(!ticks--){
    outpw(SERVO_PORT, (1<<CurrChan) );
    ticks = SetTime[CurrChan++];
    CurrChan %= nCHAN; } }