At 02:11 PM 1/10/00 +1100, you wrote: >On Sun, Jan 09, 2000 at 07:59:42PM -0500, Byron A Jeff wrote: >> - Change the prescale to 64. That with the normal /4 gives you exactly >> 15625 ticks per second. I get 61.035 (64uS * 256 = 16385uS/Int) >> - Use a 2 byte countdown timer. Use the decfsz instead of incf so that you >> know immediately when the timer has counted down. Also it doesn't require >> the use of the W register. > >Aha, so you don't have to save registers first! > >> Something like: >> >> Interrupt: >> decfsz ticklo,F >> return >> decfsz tickhi,F >> return Unless I missed something the author was trying to get across, this actually works out to 256 seconds, not 1 second. The countdown depicted amounts to a delay of 15625 interrupts. Each interrupt is 64uS (prescale) times 256 (TMR0) which equals 16384uS. Multiply this times the delay of 15625 interrupts gives a total delay of exactly 256 seconds. It is however MUCH better of an idea than resetting the TMR0 register, so I made some changes which ended up like so: Interrupt: decfsz tickhi,f ;counting down from 61 goto IntBail ;16385uS * 61 = 999424uS/"second" ;1 "second" has elapsed now movlw D'61' ;reset every "second" movwf tickhi decfsz tickadj,f ;counting down from 57 goto IntPerSecond IntAdjust: movlw D'63' ;add 32768uS every 57 "seconds" movwf tickhi ;results in 64uS lost / 57 "seconds" movlw D'57' ;or 35 seconds/year movwf tickadj IntPerSecond: call IncTime bsf IntFlags,SecFlag;indicate that a second has elapsed IntBail: The accuracy could probably be refined further, but this is good enough for now, especially considering the crystal may have wider variations than the routine itself. I have tried this in-circuit, and the results are on-target based on casual comparision against my PC clock. Many thanks for the help! JB