I use the comparator 1 module and it's works fine. however, when I set up the comparator interrupt it starts to mess up.
I once used an USART interrupt and changed it to comparator interrupt, I'm a beginner here and I don't know if I didn't change something.
this is the code in my MPLAB
Appreciated for your time
I once used an USART interrupt and changed it to comparator interrupt, I'm a beginner here and I don't know if I didn't change something.
this is the code in my MPLAB
Code:
//**BEGIN INTERRUPT CONTROL**
#pragma code InterruptVectorHigh = 0x08 //interrupt pointer address (0x08 high priority)
void InterruptVectorHigh (void)
{
_asm //assembly code starts
goto InterruptHandlerHigh //interrupt control
_endasm //assembly code ends
}
#pragma code
#pragma interrupt InterruptHandlerHigh //end interrupt control
void InterruptHandlerHigh() // Declaration of InterruptHandler
{
if(PIR2bits.CMIF){
intr = 1;
PIR2bits.CMIF = 0; //Clear Flag
}
INTCONbits.GIE = 1;
PIE2bits.CMIE = 1; //Re-enable all interrupts
return;
}
Appreciated for your time