I thought it might be for a servo.
First, take a look at this program I did many years ago ...
http://www.pbpgroup.com/modules/wfse...hp?articleid=2
It uses a single timer for both the on and off times.
As for the execution times for various statements, there is no one answer.
It depends on what size the variables are, what bank the registers are in, and where in the code the statement is located.
A statement like A = B can take anywhere from 2 to 8 assembly language instructions. Which at 4mhz would be 2 to 8uS.
For getting in and out of the interrupt, the differences are even greater depending on the type of handler used.
The PWPS program accounts for those times by adding the reload values to the accumulated timer values.
It's ISR is strickly assembly language, but the same thing can be done with DT_INTS.
Bookmarks