PIC16F882: 14us interrupt overhead when using TMR0

dannyf

Joined Sep 13, 2015
2,197
this old code introduces 3us period error
The actual amount there would vary, depending on compiler mode as well as if LED_DLY is a constant or variable - looking at the disassembly would help determine that.

I typically do this:

Code:
  TMR0+=-LED_DLY+TMR_ERRORTERM; //where TMR_ERRORTERM is 2 - 4 depending on the disassembly
If you are generating 22us pulses, PWM may be the better way to go.
 
Top