RAC_INT -- RA Port Change
Uses INTCON,RAIF, RAIE Registers and Control Bits.
DT's Interrupts MUST be used with PicBasic Pro and MPASM.
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 block of instructions will establish the interrupt used and the PBP label (your ISR) to jump to once interrupt occurs. Remember; all PBP labels or variables used inside ASM code blocks must be preceded by the underscore,( _GetData). All instruction to the interrupt processor should be in ASM and preceded by the @ symbol and to the far left column of the editor if not included in other ASM code blocks.
Example:
@ INT_DISABLE RAC_INT
ASM
INT_LIST macro ;IntSource Label, Type, ResetFlag? INT_Handler RAC_INT _GetData PBP Yes endm INT_CREAT ; Creates the interrupt processor INT_ENABLE RAC_INT ;enables external (INT) interrupts
ENDASM
Command functions:
INT_CREATE.................Creates the interrupt processor
INT_ENABLE RAC_INT.....to enable RAC interrupt after handler is created.
INT_DISABLE RAC_INT...disable RAC interrupt.
INT_CLEAR RAC_INT......clear flags
INT_RETURN.............. To restore and return to the program where interrupt was made.
Make sure your port pin is set to digital.
IOCA register must be set for your application.
NOTE: With any of the PORT change interrupts, you MUST Read the port inside the handler to end the "mismatch" condition.
Otherwise DT_INTS can't reset the int flag, and it will lock up in a continuous interrupt loop..
A simple Dummy = PORTA in the handler will do it.
Example by Bruce
<< INT_INT | 14-bit sources | RBC_INT >>