On Thu, 8 Mar 2001, myke predko wrote: > Hi James, > > The only thing that I wasn't sure about was the lines: > > ;; subtract 1s from copy of counter > movlw d'1000000'&0xff > subwf t0,f > btfss status,c > decf t1,f > > This is an eight bit subtract of a 24 bit value, but you are not bringing > the carry to the most significant byte ("t2"). I haven't done any kind of > analysis on what this can do to you, but I'm sure every once in a while it > will bite you. > > I would suggest something like: > > ;; subtract 1s from copy of counter > movlw d'1000000'&0xff > subwf t0,f > btfsc status,c > goto $ + 5 ;; If No Borrow, Subtract from the Middle Byte > movlw d'1' > subwf t1,f > btfss status,c > decf t2,f ;; "t1" was Zero upon Entry into Subtraction Routine, Decrement > t2 If you wanna do this why not do it like: clrf FSR ;) Intentional obfuscation movlw d'1000000'&0xff subwf t0,f RLF FSR,w subwf t1,f RLF FSR,w subwf t2,f If FSR is always 0, then the clear only needs to be done once. another variation: movlw d'1000000'&0xff subwf t0,f movlw 1 skpnc subwf t1,f skpnc subwf t2,f -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads