AssemblyInts

If you are only using Assembly Language Interrupt handlers, then the only file you need to include is DT_INTS-18.bas. And, remember to tell it if you are using Low Priority interrupts with the DEFINE. (See Low Priority Ints)

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.


; Initialize your Hardware first

LED1 VAR PORTB.1
LOW LED1 ; Set to Output Low

INCLUDE "DT_INTS-18.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
ENDASM

T1CON = $31 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts

Main:
PAUSE 1
GOTO Main

'---[TMR1_INT - interrupt handler]------------------------------------------
ASM
ToggleLED1
btg _LED1 ; toggle the pin
INT_RETURN
ENDASM
Code Size = 250 bytes

Page last modified on February 07, 2018, at 07:34 PM