;
; ISR_Trim routine is used to adjust the RTC 1-second period to
; within plus or minus 200-nsecs to make up for a crystal which
; may be slightly off frequency. The routine adds or subtracts
; one 200-nsec count (1 Tcyc) from Timer 2 for the first 'CCTR'
; number of 1-msec interrupts each second. Theoretical accuracy
; to within 6.3 secs/year, not including temperature drift and
; crystal aging.
;
; variables: CCNT, correction count from EEPROM [00 to FF]
; CVAL, correction value from EEPROM [FF or 01]
; CCTR, correction counter reloaded from 'CCNT'
; variable each 1-second period
;
; range: ±255 200-nsec counts/second (±51.0 usecs/sec)
;
ISR_Trim
movf CCTR,W ; correction counter 0? |B0
bz ISR_Sw_Input ; yes, branch, else |B0
decf CCTR,f ; decrement counter |B0
movf CVAL,W ; get correction value FF or 01 |B0
addwf TMR2,f ; apply 1 Tcyc timer correction |B0
;
ISR_Sw_Input