Henrik,
I agree with you that it must be the HPWM command that is causing the blips since the 46K22 has a buffered PWM.
However, as you can see from the source code, i do most things by setting the register directly like the ADC scanning. However, i have not yet been able to get the PWMs to work by setting them manually.
The PLL bug is because certain elements of PBP do not account for the 4 times increase of the clock speed due to enabling of the on-board PLL. It's those elements that ignore "Define OSC" and try to determine clock speed on their own.

Demon and Dave,
I agree the code is not optimal, it's the resultant mess of trying to debug the problem and sticking stuff in subroutines so that i can call it anywhere and not have to worry about it coming back correctly.


I'll go take a look for manual setting of the PWM and see if that sorts it...

Thanks guys.