I am programming a DSPIC33EP512GM710-I_PT TQFP using MPLABX The problem is that I generate 2 similar interrupts the MPlabX it writes the same function name in several .c files so the compiler generate an error because 2 or more functions with same name are created
Here are 2 possible solutions:
Solution-1: Change interrupt name, but then I o not know if the interrupt will be reached
Solution-2: Comment all but one of the interrupt functions and in that interrupt ask for registers to look what was the real interruption
Note: I have seen the post: What does __attribute__((__interrupt__, no_auto_psv)) do? And also the manual: (https://www.mouser.com/datasheet/2/268/MPLAB_XC16_v1_10_C_Compiler_UG_52081-477561.pdf page 128)
But I do not know what does micro when reaches an interruption if it look sequentially in all the attribute((interrupt, no_auto_psv)) codes
Here is my code corresponding to solution-2:
void __attribute__ ( ( interrupt, no_auto_psv ) ) _CM1Interrupt(void)
{
/*
* ************* ALTERADO PARA ACEPTAR OTROS COMPARADORES ************************
// CMP1 callback function
CMP1_CallBack();
// Clear the CEVT bit to enable further interrupts
CMP1_EventStatusReset();
*/
if (CM1CONbits.CEVT)
{
//all up mosfets to 0
aplica_mapa(0,6); //todo a 0
delay_us1(5);
CMP1_EventStatusReset();
}
if (CM2CONbits.CEVT)
{
//all up mosfets to 0
aplica_mapa(1,6);
delay_us1(5);
CMP2_EventStatusReset();
}
if (CM5CONbits.CEVT)
{
//all up mosfets to 0
aplica_mapa(3,6); //todo a 0
delay_us1(5);
CMP5_EventStatusReset();
}
// clear the CMP1 interrupt flag
IFS1bits.CMIF = 0;
}