Sending Signals to Servo Motors

The servos are another significant electormechanical component as they are required to turn on the lights. The position of the servo is determined by the Pulse Width Modulation signal (PWM) coming from the PIC’s RC2 port. The CCP1CON register was configured for PWM, the Timer2 was initialized and the duty cycle was set for both the “Lights On” (ON) Position and the “Lights Off” (Neutral) Position. The duty cycle for ON was 99% and the duty cycle for Neutral was 6%. The code for the neutral position of PWM is shown in Figure \ref{fig:SERVOS}.