Here's another example of a Blinky Light program using TMR1 with an Assembly
Language Interrupt handler.
Note that the INT_Handler's Type is
ASM, and the Label does not have an
underscore before it.
Code:
LED1 VAR PORTD.0
LOW LED1 ; Set to Output Low
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, ToggleLED1, ASM, yes
endm
INT_CREATE ; Creates the interrupt processor
INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts
ENDASM
T1CON = $31 ; Prescaler = 8, TMR1ON
Main:
PAUSE 1
GOTO Main
'---[TMR1_INT - interrupt handler]------------------------------------------
ASM
ToggleLED1
btfsc _LED1
goto $+3
bsf _LED1
goto $+2
bcf _LED1
INT_RETURN
ENDASM
Code Size = 104 Words