ServoPIC
(On Servo Driving PIC)
Function: Main()
Initialize Interrupts ,Timer0 for measuring period and dutycycle
if attack pin has been set high from low, start timer, set attack flag to high
if attack pin has been set low from high, set attack flag to low
if timer expires, set attack flag to low
End
Function: Interrupt ISR()
if Timer overflows, increment Byte measuring the time
if the duration for period of the servo is reached, set PWM to high.
else if PWM has been high for Attack Duty cycle and attack flag is high, lower the PWM pin
else if PWM has been high for Retract Duty cycle and attack flag is low, lower the PWM pin
clear Timer overflow flag
End
Initialize Interrupts ,Timer0 for measuring period and dutycycle
if attack pin has been set high from low, start timer, set attack flag to high
if attack pin has been set low from high, set attack flag to low
if timer expires, set attack flag to low
End
Function: Interrupt ISR()
if Timer overflows, increment Byte measuring the time
if the duration for period of the servo is reached, set PWM to high.
else if PWM has been high for Attack Duty cycle and attack flag is high, lower the PWM pin
else if PWM has been high for Retract Duty cycle and attack flag is low, lower the PWM pin
clear Timer overflow flag
End