Mark,
I'm thinking that maybe you need to move the USB interrupts to Low Priority, so that it won't interfere with the PWM interrupts.
Like this ...
Code:
DEFINE USE_LOWPRIORITY 1
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP-18.bas"
ASM
;----[High Priority Interrupts]-----------------------------------------------
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler INT_INT, _Do_WaveMakers, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
;----[Low Priority Interrupts]------------------------------------------------
INT_LIST_L macro ; IntSource, Label, Type, ResetFlag?
INT_Handler USB_Handler
endm
INT_CREATE_L ; Creates the Low Priority interrupt processor
endasm
And you may need to synchronize loading the CCP registers with Timer2.
Or, use HPWM10 ... http://www.picbasic.co.uk/forum/show...7805#post37805
HTH,
Bookmarks