Top  Previous  Next


Configures the number of servos and their pins.




Config SERVOS = number , SERVO1 = P1.1 , SERVO2 = P1.2 , SERVO3 = P1.4 , SERVO4 = P1.5 , RELOAD = value





The number of servos you want to use.

When you specify 2, you must also add the SERVO1 and SERVO2 parameters.


The pin that is attached to servo 1.


The pin that is attached to servo 2.


The pin that is attached to servo 3.


The pin that is attached to servo 4.


The reload value in uS. Default 100 uS


The CONFIG SERVOS compiler directive will include an interrupt that will execute every 100 uS. The TIMER0 interrupt is enabled and the TIMER0 is started.

The number of bytes used by the use of SERVO's is 1 + number of servos.


When you use 2 servo's , it will take 3 bytes of internal memory.

TIMER0 can not be used by your program anymore.

To change the pulse duration you assign the special reserved variables the number of 100 uS steps:

SERVO1 = 8 '800 uS pulse

SERVO2 = 12 '1200 uS duration

After 20 mS the pulses will be sent again to the port pins.


The maximum number of servo's is 14. The example shows how to set it up for 4 servo's only.

When you specify RELOAD = 50 , 50 uS steps will be used!

When you have  a lot of servo's the RELOAD must be higher than when you have less servos. When you have a reload of 10 uS for example it will be impossible for the 8051 to handle more than 1 servo without losing time.

For 2 servo's 20 or 25 should be used for best results.