gonespa
Member level 1
Hi,
I Am trying (for now just using the MPLABX simulator) to trigger an interrupt each time any of the associated PINs (CAP1,2 & 3) changes state.
If I configure the MCU this way:
The ISR is this one:
And then force a PIN change using the stimulus on any of the CAPx pins, I observe that the corresponding PIR3 bit is set, but the ISR is never triggered. I tried with a watchpoint and it is evident too due to the fact that, each time the ISR is triggered the variable "contador" is incremented, something that never happens...
I tried to play changing the order in which each flag is activated with no success. Is anything I am missing?
I Am trying (for now just using the MPLABX simulator) to trigger an interrupt each time any of the associated PINs (CAP1,2 & 3) changes state.
If I configure the MCU this way:
Code:
TRISAbits.TRISA2 = 1;
TRISAbits.TRISA3 = 1;
TRISAbits.TRISA4 = 1;
T5CONbits.TMR5ON = 1;
CAP1CONbits.CAP1M0 = 0;
CAP1CONbits.CAP1M1 = 0;
CAP1CONbits.CAP1M2 = 0;
CAP1CONbits.CAP1M3 = 1;
CAP2CONbits.CAP2M0 = 0;
CAP2CONbits.CAP2M1 = 0;
CAP2CONbits.CAP2M2 = 0;
CAP2CONbits.CAP2M3 = 1;
CAP3CONbits.CAP3M0 = 0;
CAP3CONbits.CAP3M1 = 0;
CAP3CONbits.CAP3M2 = 0;
CAP3CONbits.CAP3M3 = 1;
PIR3bits.IC1IF = 0;
PIR3bits.IC2QEIF = 0;
PIR3bits.IC3DRIF = 0;
PIE3bits.IC1IE = 1;
PIE3bits.IC2QEIE = 1;
PIE3bits.IC3DRIE = 1;
INTCONbits.PEIE = 1;
INTCONbits.GIE = 1;
The ISR is this one:
Code:
void interrupt isr(void)
{
step();
if (contador == 5)
{
contador = 0;
}
else
{
contador++;
}
PIR3bits.IC1IF = 0;
PIR3bits.IC2QEIF = 0;
PIR3bits.IC3DRIF = 0;
}
And then force a PIN change using the stimulus on any of the CAPx pins, I observe that the corresponding PIR3 bit is set, but the ISR is never triggered. I tried with a watchpoint and it is evident too due to the fact that, each time the ISR is triggered the variable "contador" is incremented, something that never happens...
I tried to play changing the order in which each flag is activated with no success. Is anything I am missing?