CMP_INT    -- Comparator Interrupt

Uses PIR2,CMIF, PIE2,CMIE Registers and Control Bits.
Uses PIR1,CMIF, PIE1,CMIE Registers and Control Bits.
Uses PIR2,C1IF, PIE2,C1IE Registers and Control Bits. -- Comparator 1
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.


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


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

interrupt fires when a conversion is complete.

You should read the CMCON register inside the handler to end the mismatch condition.

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

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