On Mon, 23 Mar 1998 16:41:44 -0500 myke predko writes: >This is why I use the code: > > movlw 1 > subwf Count > btfss STATUS, C ; If Carry Not Set, Then Gone from 0 >to 0x0FF > decf Count+1 You could also use this routine, which doesn't affect W or C: movf Count,f ;Test if LSB is zero -- if so, set Z. btfsc STATUS,Z ; If low byte won't roll under, don't decf Count+1,f ; need to dec. high. decf Count,f ;Always dec. low byte. But it doesn't have a good way to tell if the decremented Count is now zero. After Myke's routine, the Z flag will be set when both bytes of Count are zero(i.e. if Count was 0001 before the routine). Myke's routine can also be modified to detect when the count rolls under past zero by replacing the decf of the high byte with another subwf. In this case, the C flag will be clear only if Count is now FFFF (was 0000 on entry), and the Z flag test for zero will also still work. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]