This is the rampup subroutine.

rampup:
For final_duty = 1 to limit
delay = 1000 / limit
pause delay
CCP1CON = %00111100
PR2 = 44
high_duty=(final_duty>>2) 'high 6 bits in CCPR1L
low_duty=(final_duty<<6) 'low two bits for CCP1CON
low_duty=(low_duty>>2) 'shift back to CCP1CON<5:4>
low_duty.3=1 'PWM configuration bit
low_duty.2=1 'PWM configuration bit
CCPR1L=high_duty
CCP1CON = $0C
T2CON = 4
Next final_duty


return