Hello Mike. > What's the best way to guarantee a valid output with only one execution > of the update routine? Maybe changing the whole approach to use a > counter that counts from 0 to 7, then generating ths scan mask from it > (Most likely any real application will require both a count and a mask > anyway). The counter can be guaranteed valid just by ANDing it with 7. How about following example: ; get a lowest "1" bit in a byte movfw scanbit sublw 0 andwf scanbit,f skpnz ;if _Z=1 than _C=1 too (see sublw) bsf scanbit,_N ;if _Z=1 than init scanbit with 1<<_N ;where _N is desirable position ; calc. next scan_value rlf scanbit,w rlf scanbit,f ; WBR Dmitry.