<table cellpadding=6><tr><td valign=center>
</td><td>The Instant Interrupt System consists of several "Layers".
The Bottom Layer is "DT_INTS-14.bas". This file contains everything required to use Interrupts at the ASM level. It handles all of the "Context Saving/Restoring", detects which interrupt has been triggered, and calls the appropriate "User Routine".
The next layer up is created from the INT_LIST macro you define in the program. It defines the Interrupt sources to use and the corresponding subroutines that will be called. They can be either simple subroutines, or complete "Modules" in a separate Include file, like the Elapse Timer. Up to 14 separate INT_Handler's can be in the LIST.
And, the Top Layer is the normal PBP program that runs in the foreground.
If Basic Laguage interrupts are not being used, then DT_INTS-14.bas is the only file you need to include.</td></tr></table>Here's another example of a Blinky Light program using TMR1 with an Assembly Language Interrupt handler
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
<font size=-3>Code Size = 104 Words</font>
Notice that the INT_Handler's Type is ASM, and the Label does not have an underscore before it.<hr><table cellpadding=6><tr><td>
</td><td valign=top>By using this type of Layering scheme. It allows us more flexability, depending on the type of interrupt we want to use. If we want to add Basic Language Handlers, all we need to do is Include "ReEnterPBP.bas", and it will insert another Layer in-between the Base and the Handlers.
With this layer included, you can have any combination of ASM and PBP interrupts in the same program</td></tr></table>
<br>
Bookmarks