Page 1 of 1
Interrupt on 24FJ256
Posted: Thu Jul 07, 2011 2:28 pm
by Mathy
Hi !
I need to have some explanation about how interrupt works on these PIC24FJ.
For example, on the 24FJ256GA110, the INT0 seems to be muxed with the 55th pin but which pin I have to use for INT1 and INT2 ?
What about the interrupt on port ? What is the port concerned by this interrupt ?
Thank you for your time.
Mathy
Re: Interrupt on 24FJ256
Posted: Mon Jul 11, 2011 1:28 pm
by Mathy
Hello,
Any help ?
Re: Interrupt on 24FJ256
Posted: Mon Jul 11, 2011 3:23 pm
by Benj
Hello Mathy,
Sorry for the delay.
The interrupt pins INT1 to INT4 are remappable on this device so you can use any I/O pin marked with RPx on the device datasheet.
Section 10.4 of the device datasheet details this functionality.
INT1 - RPINR0
INT2 - RPINR1
INT3 - RPINR1
INT4 - RPINR2
Here is the C code you would use to assign the RP number to the functionality.
INT1: RPINR0 = (RPINR0 & 0x00FF) | ( x << 8 );
INT2: RPINR1 = (RPINR1 & 0xFF00) | x;
INT3: RPINR1 = (RPINR1 & 0x00FF) | ( x << 8 );
INT4: RPINR1 = (RPINR2 & 0xFF00) | x;
Where x is the RP pin number you wish to assign.
Add the C code using a C code icon before you enable the interrupt.
For the PORT interrupt you have control over which pins can trigger the interrupt. Registers CNEN1 through CNEN6 select which pins are active for the interrupt. Setting a bit in the CNEN register will enable the PORT interrupt for that particular pin. The CN numbers are again available from the diagram on the device datasheet.
Let me know if you have any problems.