Hi,
Not that I think it's a problem but why TWO returns in the subroutine? The execution will never get to the second one.
Are you sure that the output really IS "stationary", it's not just that you have the horisontal sweep set to fast?
Wrap the ISR in a LED1 = 1 and LED1 = 0 and sample PortB.1 too with your "scope", that way you'll see IF and and what frequency the interrupt ACTUALLY runs as well as how long it takes to execute.
With 4MHz crystal, PR2 set to 199 and prescaler set to 1:1 you should be getting 5kHz PWM but your "scope" (if I read it correctly) shows a period of 400us which means a PWM frequency is 2.5kHz, why is that?
Bookmarks