;
; unsigned char Timer [] = { 23, 00, 00 }; // hrs, mins, secs
;
; if (TimerEnabled) // if Count Down Timer enabled
; { n = 2; // index seconds array element
; while (!Timer[n]--) // while value 00 (post dec value)
; Timer[n--] = 59; // set to 59 and bump array index
; if (!(TimerEnabled = Timer[0]+Timer[1]+Timer[2]))
; { // perform timed out code here
; }
; }
;
ISR_TMR
btfss TMRENA ; is TMR turned on? |B0
goto ISR_Next ; no, branch, else |B0
movlw TMRSEC ; |B0
movwf FSR ; setup indirect access |B0
ISR_T0 movf INDF,W ; is value 0? |B0
bnz ISR_T1 ; no, branch, else |B0
movlw h'59' ; |B0
movwf INDF ; reset to '59' |B0
decf FSR,f ; decrement array index |B0
goto ISR_T0 ; test next array element |B0
ISR_T1 decf INDF,F ; post decrement array element |B0
movf TMRHRS,W ; check for time-out |B0
addwf TMRMIN,W ; |B0
addwf TMRSEC,W ; timed out (00:00:00)? |B0
bnz ISR_Next ; no, branch, else |B0
bcf TMRENA ; turn off timer enabled flag |B0
; perform timed out code here |B0
ISR_Next