On Sun, 2 Mar 2003, Tony K|bek wrote: > Hi, > I haven't read most if this thread so at the moment I have no > code to post, however I saw this bit from Scott Dattalo: > > >Here's a solution that saves one instruction: > > > > rlf TMR1L,W ; read the msb of tmr1L --> Carry > > incf TMR1H,W ;Assume that the low byte is about to > rollover > > movwf TMR1H_buff > > > > movf TMR1L,W > > movwf TMR1L_buff > > > > skpnc ;If TMR1L on the first read was < 0x80 > > btfsc TMR1L_buff,7 ;or if the both reads are between > > decf TMR1H_buff,F ;0x80 and 0xff then leave the high byte alone > > Wouldn't the "incf TMR1H,W " possibly trash the carry ? (if TMR1H is > 0xFF) On the 18F452, yes. But this is for the midrange PIC's. And if you recall, INCF does not affect the carry on the 12 and 14 bit cores like it does on the 16-bit cores. BTW, there still is a bug in the code above. also, BTW, I re-read Dave Tweed's solution. His solution is the best for solving the problem that was asked. Scott -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu