Quote Originally Posted by RussMartin View Post
... Using the o'scope, I see that each of those IF . . . THENs actually takes only about 22us; that's only 110us for all 5. ...
That's 110us * SOMETHING (the loop count).

If SOMETHING is ever higher than 63, you will have used up the 7ms and more.

With the ASM code I gave, each IF takes only 2us @8mhz.
SOMETHING can be 255 and it will still only take ~2.6ms.

hth,