List of Interrupts based on DT_INTS-14 vers.1.1; GPC_INT, IOC_INT, RAC_INT, RABC_INT and the original RBC_INT are all forms of Port Change Interrupts. The chip being programmed determines which one you need to use.
The following INCLUDE files should be near the beginning of your program. There are other INCLUDE files for special functions which will be discussed in the appropriate location.
DT's Interrupts MUST be used with PicBasic Pro and MPASM.
'INCLUDE "DT_INTS-14.bas"' for 14bit devises
INCLUDE "ReEnterPBP.bas
NOTE: DT_INTS-14 and ReEnterPBP needs 31 bytes of Ram with DT_INTS-14 using 7 bytes.
INT_ENABLE xxx_INT ;to enable interrupt after handler is created.
INT_CLEAR xxx_INT ;clear interrupt flags bits
INT_DISABLE xxx_INT ;clear interrupt enable bits
INT_RETURN ;to restore interrupt and return to the program location where interrupt was made.
The following variables are located at the beginning of DT_INT-1x.bas. Copy them to your main program. The compiler will instruct you as to what should be done, if anything, once you compile. DO NOT make changes in DT_INT-1x.bas program.
wsave var byte $20 system ;location for W if in bank0
wsave var byte $70 system ;location for W if in bank0
..... If any of these next three lines cause an error ...Comment them out to fix the problem...
............which variables are needed, depends on the chip you are using.......
wsave1 var byte $A0 system ;location for W if in bank0
wsave2 var byte $120 system ;location for W if in bank0
wsave3 var byte $1A0 system ;location for W if in bank0
The following block of instructions will establish the interrupt used and the PBP label (your ISR) to jump to once interrupt occures. Remember; all PBP lables or variables used inside ASM code blocks must be preceded by the underscore,( _ToggleLED1). After creating the interrupt processor all instruction to the processor should be in ASM and preceded by the @ symbol and to the far left column of the editor if not included in ASM code blocks.
@ INT_DISABLE INT_INT
INTerrupts Execution Order:
ASM
INT_LIST macro ;IntSource Label, Type, ResetFlag? INT_Handler INT_INT _ToggleLED1 PBP Yes endm INT_CREAT ; Creates the interrupt processor INT_ENABLE INT_INT ;enables external (INT) interrupts
ENDASM
NOTE: Make sure IN_Handler, INT_CREAT, and INT_ENABLE are indented!
Multiple interrupts may be used.
ASM
INT_LIST macro ;IntSource Label, Type, ResetFlag? INT_Handler INT_INT _ToggleLED1 PBP Yes INT_Handler TMR0_INT _TimeOut PBP Yes INT_Handler TMR1_INT _TimeOut2 PBP Yes endm INT_CREAT ; Creates the interrupt processor INT_ENABLE INT_INT ;enables external (INT) interrupts
ENDASM
NOTE: Up to 14 separate INT_Handler's can be in the LIST.