Beats me. I didn't write that (or any beep stuff) *whew*. I don't use dumb delays and would never delay inside an interrupt routine at any rate.John, may I ask why there's an 11 cycle delay in the PWM routine, please?
One way to mitigate PWM jitter as things get longer in the IRQ service is to set it up to write a pre-calculated PWM value to the port as the first thing in the interrupt service routine. Just slam it out there including copying GPIOimg to GPIO. Then you have time to go through things and calculate the PWM value to be output on the next interrupt. As it is, I didn't see any jitter to speak of but I wasn't looking at it real hard.