CMP2INT

CMP2_INT -- Comparator 2

Uses PIR2,C2IF, PIE2,C2IE Registers and Control Bits.
DT's Interrupts MUST be used with PicBasic Pro and MPASM.

The comparator interrupt flag is set whenever the camparators value changes relative to the last value loaded into CMxOUT bits.



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,( _GetDig). 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 CMP2_INT

ASM

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

ENDASM

Command functions:
INT_CREATE ;Creates the interrupt processor
INT_ENABLE CMP2_INT – enable CMP2 interrupt.
INT_DISABLE CMP2_INT – disable CMP2 interrupt.
INT_CLEAR CMP2_INT – clear flags
INT_RETURN ---------- To restore and return to the program where interrupt was made.

<< CMP1_INT | 14-bit sources | EE_INT >>

Page last modified on March 16, 2018, at 11:09 PM