Quote Originally Posted by Bruce View Post
i is the bit index. PORTB.0[i] = 0 is PORTB.BIT[i] = 0. i increments from 0 to 7, so it clears
PORTB.0 to PORTB.7.

I'm happy you posted this question tazntex. I never used the REPEAT instruction, but as a programmer I know I would have fallen into one of those see-what-you-want traps, something like this:

i = 0
REPEAT
PORTB.[i] = 0
i = i + 1
UNTIL i > 7

I would have looked at this code for hours before seeing where I went wrong.


(I wished we had a button that allowed us to use the CODE command, I can never remember the syntax.)