Quote Originally Posted by mr.sneezy View Post
There are a heap of ways to make a tight loop (If-then, While-wend, repeat-until). What would be the tightest (fastest) ? ASM ?
Anything that requires precise timing should be done in the handler, preferably in an ASM handler.

When it returns to the Main loop with a Flag set, the process it triggers should be able to do it, "whenever it gets around to it". There may be several things going on, and there's no guarantee when it will be processed.

If you're reading servo pulses, then the entire process of measuring the pulse should be done with the interrupts, and I don't mean sitting in a PULSIN statement in the handler. On the rising edge, start a timer. On the falling edge, stop the timer and collect the reading. Each time leaving the handler until the next condition occurs. Once you have a reading, then set a flag to let the main loop know to process the data. Now it has all the time in-between pulses to work on all those error rates, jitter etc and display them on the LCD at it's leisure.