Here is pseudo code to do 2 servos:
int servo_1_pulse; // number of microseconds of servo 1 pulse
int servo_2_pulse; // number of microseconds of servo 2 pulse
int remainder; // number of microseconds left in 2 milliseconds after the last servo pulse goes off
while (1)
{
turn_servo_1_on();
turn_servo_2_on();
if (servo_1_pulse < servo_2 pulse)
{
delay_microseconds(servo_1_pulse);
turn_servo_1_off();
delay_microseconds(servo_2_pulse - servo_1_pulse);
turn_servo_2_off();
remainder = 2000 - servo_2_pulse;
}
else
{
delay_microseconds(servo_2_pulse);
turn_servo_2(off);
delay_microseconds(servo_1_pulse - servo_2_pulse);
turn_servo_1_off();
remainder = 2000 - servo_1_pulse;
}
delay_microseconds(50000 - remainder);
}
This has the disadvantage of not doing anything else except controlling the 2 servos (which might be all right if that is all you are doing.)
In order to do other things, you could, instead of the last delay(), capture a running clock, call a function that does other stuff that will take less then 48mSec, then capture the clock again to see how much time has elapsed and wait for 48mSec - the time already elapsed.
If you wanted to do more than two, there are better ways to do that.
Bob