Hi,
I think the problem is here:
Code:
CCP1CON = %00111100            '<-- Here you actually set the two LSB's of the dutycycle register.
PR2 = 99                                  ' <--There's no need to set PR2 every time thru the loop.
high_duty=(dutycycle>>2)        'high 6 bits in CCPR1L
      low_duty=(dutycycle<<6)         'low two bits for CCP1CON 
      'low_duty=(low_duty>>2)           'shift back to CCP1CON<5:4>  
      low_duty.4=0                     'PWM configuration bit 
      low_duty.5=1                     'PWM configuration bit
CCPR1L=high_duty
CCP1CON = $0C                       '<- Then you reset the two LSB's of the dutycycle register.
T2CON = 4                               '<- No need to set this every time
So, the glitch probably comes from the fact that even when your dutycycle variable is 0 you actually set the dutycycle to 4 (the two LSBs in CCP1CON being set by CCP1CON = %00111100) and then back to 0 again by CCP1CON = $0C.

Set up the module (ie CCP1CON and PR2) at the beginning of the program. If you need to use the lower two LSBs of the dutycycle then assign those bits in CCP1CON individually each time thru the loop. Don't mess with PR2 or T2CON every time thru the loop.

Finally, you do a lot of bit shifting an dflippin on the Low_Duty variable but you never actually USE it to set the dutycycle, you're only using the 8 high bits in CCPR1L.

/Henrik.