I'm guessing here...'cause I don't see ALL of your code...just a couple of ideas...
You're probably seeing jitter caused by ON INTERRUPT.
The ON INTERRUPT is probably being triggered at different points in the code and might have a different amount of clock cycles before it actually gets into the interrupt code.
The number of cycles it takes to get to the interrupt code might be different between the 'dummy = dummy + 1' part and the 'goto main' part.
WDT on? If it is, might be timing out causing the PIC to reset, resetting all the variables, therefore screwing up the timing overall.
EDIT: Forgot to mention that using DT's Fast Interrupt routines would most likely solve any interrupt latency issues.





Bookmarks