Below is an extract from a piece of code, it is an interrupt routine triggered by TMR2 to produce a single pulse of a set length controlled by the PR2length byte sized variable. This uses Darrel Taylor's interrupt code.

Currently the pulse length is longer than I intend it to be due to the lines of code prior to the T2CON line (turning the pulse on) and also the interrupt triggering routine. I know I need to change the PR2length variable so that it triggers earlier to produce a pulse of the correct length.

I could do this by trial and error, though I was wondering if anybody had any experience or detail how many cycles it takes to do various tasks in PIC BASIC PRO. e.g. how many cycles it would take to copy the PR2Length variable to the PR2 register, and how long it would take to run Darrel's code to allow it to jump to the interrupt routine.

Any information or guidance on how to find this out would be appreciated.

Code:
PulseRestart:
TMR2 = 0
PR2 = PR2length
T2CON = %01001111 'Restart pulse length timer
TMR1H = Tmr1LENGTH.highbyte 'Transfer the timer variables to the timer1 register
TMR1L = tmr1LENGTH.lowbyte
T1CON = %00010101 'Start Pulse High Timer
pulseout = 1
@ INT_RETURN ;RETURN
This is using a PIC12F683