;
; unsigned char Timer [] = { 23, 00, 00 }; // hrs, mins, secs.
;
; if (TimerEnabled) // if Count Down Timer enabled
; { unsigned char 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
; } // turn off timer when timed-out
; if(!(TimerEnabled = Timer[0]|Timer[1]|Timer[2]))
; { // perform timed-out code here
; }
; }
;
ISR_TMR
btfss SW.TMR ; timer switch turned on? |B0
goto ISR_Next ; no, branch, else |B0
movlw TMRSEC ; |B0
movwf FSR ; setup indirect access |B0
ISR_T0
movf INDF,W ; array element = 00? |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
addlw -1 ; post decrement element |B0
skpdc ; |B0
addlw -6 ; |B0
movwf INDF ; |B0
movf TMRHRS,W ; check for time-out |B0
iorwf TMRMIN,W ; |B0
iorwf TMRSEC,W ; TMR = 00:00:00? |B0
skpnz ; no, skip, else |B0
bcf SW.TMR ; turn timer switch off |B0
;
ISR_Next