microcontrollermikrocdspic

dsPIC33 external interrupt


I am trying to understand how to attach external falling edge interrupt to a dsPIC33EP512MU810 micro controller. From browsing the internet I have found the following code:

RPINR0= 0x5400;//set pin 1 as interrupt 1
INTCON2 = 0x0000;   /*Setup INT0, INT1, INT2, interrupt on falling edge*/
IFS1bits.INT1IF = 0;    /*Reset INT1 interrupt flag */
IEC1bits.INT1IE = 1;    /*Enable INT1 Interrupt Service Routine */
IPC5bits.INT1IP = 4;    /*set low priority*/

I am trying to understand how to attach this interrupt to A10. What address should I pass to the RPINR0? And which pins can be used for such interrupt?


Solution

  • RPINR0 requires the RP-Pin number (you can look in the datasheet next to the pin). E.g. if you wanted to use Pin E5 it reads: AN29/PWM3H/PMD5/RP85/RE5 - meaning its remappable pin 85. So

    PRINR0bits.INT1R = 85; 
    

    would work.

    However for pin A10 it reads: VREF+/RA10 - meaning A10 is not available as a remappable In-/Outport.

    Sry, you will have to choose another pin.

    Kind Regards, David