Whoa! Thanks for pointing that out... *sigh* I guess that's another instruction... movlw 0x01 and then use subwf. Here is my current version...I made an optimization at the end which saves two instructions (assuming the counter != 0, since if it is zero we don't need to worry about timing), but in light of the decf problem we're at 8 instructions not counting retfie...: movlw 0x01 subwf T_FL0, f btfsc STATUS, 0 ;test carry flag subwf T_FL1, f btfsc STATUS, 0 subwf T_FL2, f btfsc STATUS, 0 decfsz T_FL3 ;requires that T_FL3 be one larger than normally retfie bcf INTCON, GIE > -----Original Message----- > From: adam-request@viratech.com [mailto:adam-request@viratech.com] On > Behalf Of Andrew Warren > Sent: Wednesday, August 07, 2002 2:42 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Four byte counter - best method? > > Barry Gershenfeld wrote: > > > If you otherwise have the time, how about figuring out > > beforehand that you will reach zero on the *next* > > interrupt, and leave yourself a flag for that. > > Check at the top of the i.s.r. and you know > > after a single test. > > Before you even start to do things like that, though, it might > be helpful to re-read the data sheet and notice that DECF doesn't > affect the Carry flag. > > -Andy > > === Andrew Warren -- aiw@cypress.com > === Principal Design Engineer > === Cypress Semiconductor Corporation > === > === Opinions expressed above do not > === necessarily represent those of > === Cypress Semiconductor Corporation > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.