If that code is in your interrupt, the interrupt can never exit and you might as well have put this in your main program.
You can’t run a continuous loop. The ISR is always a call i.e.. GOSUB, and you always have to return from interrupt or your main code will never run.
What is currently triggering the interrupt?
Also, it looks like you want PWM at 50% duty cycle, but if more than one condition is true, it will break all of them.
There is a thread a little below about frequency counters. Darrel didn’t want to shove his own timer code down someone’s throat,
but it was really the answer to the problem. To his merit, he gave advice about a less efficient manner the OP was already working on.
Similarly DT’s code is the answer to your problem.




Bookmarks