This is about an issue of my own. There would be different ways to implement in a program.
It probably should have been commented like this:
Code:
; ----------------- ADD TimerConst to TMR1H:TMR1L -------------------------
ADD2_TIMER macro
BCF T1CON,TMR1ON, 0 ; 1 Turn off timer
MOVLW LOW(TimerConst) ; 1
ADDWF TMR1L,F, 0 ; 1
BTFSC STATUS,C ; 1 if carry set / 2 if carry clear
INCF TMR1H,F, 0 ; 1 if carry set /0 if carry clear
MOVLW HIGH(TimerConst) ; 1
ADDWF TMR1H,F, 0 ; 1
endm
‘ always up to seven instructions here since stopping the timer
‘ one more instruction will be used to turn on the timer in the
‘ code that called this, and there’s the eight instructions
I need to reset the timer (not add to it) if the ISR was triggered by port interrupt,
It looks like I’ll need another conditional and more instructions to check if it was portb.0 interrupt,
copy the constant values to the timer rather than add to it if it was called due to portb.0 interrupt,
and then also change the constant value to accomodate the extra instructions.
Because currently if the code was not called due to timer overflow, it is unknown what is in the timer.
It could be called by port.0 interrupt when a 0xFFFB value is in the timer for all I know.
My question if this is all because the whole DT interrupt set that can be enabled for multiple interrupts
to allow those interrupts be serviced first like I suggested above.
Bookmarks