Correct your interrupts as Henrik mentioned and I also noticed your T0count variable buried between the two interrupts and might be okay? but thought I'd point that out.
Code:
LED1 VAR PORTD.0
LED2 VAR PORTD.1
INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
INT_Handler TMR0_INT, _ToggleLED2, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
INT_ENABLE TMR0_INT ; enable Timer 0 interrupts
INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts
ENDASM
OPTION_REG = OPTION_REG & $80 | 1 ' Set TMR0 Prescaler to 256, leave RBPU alone
Main:
GOTO Main
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
'---[TMR0 - interrupt handler]-------------------------------(Blinky Light)------
T0Count VAR WORD
ToggleLED2:
T0Count = T0Count + 1
IF T0Count = 512 THEN T0Count = 0 : TOGGLE LED2
@ INT_RETURN
Another thing to keep in mind; the timers need to be updated each time at the interrupt if it was preloaded with something other than default. Incomplete example:
Code:
T0H = $48 ' 1sec overflow value for TMR0
T0L = $E4
' After DT_INTS setup
T0CON = %00000111 ' TMR0 OFF and 1:256 prescaler. Bit7 ON/OFF
@ INT_ENABLE TMR0_INT ; Enable Timer 0 interrupts
Timer0:
TMR0H = T0H ' High byte loaded
TMR0L = T0L ' Low byte loaded
TMR0_OVF = TMR0_OVF + 1 ' Overflow increment counter
IF TMR0_OVF = TOT_0 THEN ' Increment counter reaches TOT value
'Do something
ENDIF
@ INT_RETURN
Bookmarks