RBCINT

RBC_INT -- RB Port Change Interrupt

Uses INTCON,RBIF, RBIE Registers and Control Bits.
DT's Interrupts MUST be used with PicBasic Pro and MPASM.

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,( _CK_RBx). 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 RBC_INT

ASM

 INT_LIST     macro     ;IntSource      Label,    Type,    ResetFlag?
            INT_Handler   RBC_INT      _CK_RBx    PBP       Yes
            endm
            INT_CREAT              ; Creates the interrupt processor
            INT_ENABLE    RBC_INT  ;enables interrupts

ENDASM
Command functions:
INT_CREATE ;Creates the interrupt processor
INT_ENABLE RBC_INT – to enable interrupt on RB Port Change
INT_DISABLE RBC_INT – disable RBC interrupt.
INT_CLEAR RBC_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.

Check your Datasheet for IOCB or other registers that need to be addressed before implementing DT_INT's.

once it interrupts, you have to read PORTB to "End the Mismatch". A simple Dummy = PORTB in the handler will do it.

if using multiple pins you need to compare that read, with the value of PORTB the last time it interrupted to figure out which pin changed, and which state it changed to.

Darrel's RBC_INT simple setup....Post


On the 16F88x's use IOC_INT (Interrupt On Change). Set the pins you want to monitor in the IOCB register.



<< RAC_INT | 14-bit sources | RABC_INT >>

Page last modified on April 02, 2018, at 12:02 AM