I think there's several sources of the variances.
But a large portion is probably because TMR2 is left running when you turn off the CCP module.
When you put it back in PWM mode again, TMR2 is at an unknown value, and if it's over 49 (PR2) then it could take up to 100us for it to roll-over to 0 again.
When you turn off the PWM, you should Stop TMR2 and reset it to 0.
added: Or maybe just zeroing TMR2 before starting the PWM will work.
<br>




Bookmarks