On Fri, 17 Oct 2003, Ken Pergola wrote: > Hi Harold, > > How about something like this?: > > (Not the fastest and does not use DECFSZ, but can easily be expanded for > multi-byte variables) > > > > > LOOP_ITERATIONS EQU .257 ; # of loop iterations > > ; *** LoopIteration = LOOP_ITERATIONS > MOVLW high LOOP_ITERATIONS > MOVWF LoopIteration_MSB > > MOVLW low LOOP_INTERATIONS > MOVWF LoopIteration_LSB > ; *** > > > Loop > > ; { Your favorite loop action code goes here } > > > ; *** Decrement composite loop iteration variable by 1 > ; ( LoopIteration = LoopIteration - 1 ) > DECF LoopIteration_LSB, F > BTFSS STATUS, C > DECF LoopIteration_MSB, F CAUTION: this only works on the 18F series (the midrange pics DECF instruction does not disturb C). Of course, a better approach is this: beginning_of_loop: ; stuff decf LoopIteration_LSB,F skpnz decfsz LoopIteration_MSB,F goto beginning_of_loop Or even better for the 18f series: dcfsnz LoopIteration_LSB,F decfsz LoopIteration_MSB,F goto beginning_of_loop Scott -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body