Please look into https://community.nxp.com/docs/DOC-329209
There is many examples to easy understand how it works:
Also I have attached a few I use in explanation....
For example:
#pragma CODE_SEG NON_BANKED
interrupt 7 void RTI_ISR(void)
{
ARMCOP=0x55; // kick the dog
ARMCOP=0xAA;
CRGFLG = 0x80; // Clear the flag
PORTB=~PORTB;
}
#pragma CODE_SEG DEFAULT
If you go into Table 1-14. Interrupt Vector Locations then you can also use following approach which explains how to get interrupt number.
//====================================
#pragma CODE_SEG NON_BANKED
interrupt ((0xFE-0xD2)/2) void ATD0_ISR(void) // 0xD2 is an offset presented in the table for given interrupt
{
}
#pragma CODE_SEG DEFAULT

//====================================
#pragma CODE_SEG NON_BANKED
interrupt ((0xFE-0xF0)/2) void RTI_ISR(void) // interrupt ((0xFE-0xF0)/2) the same as interrupt 7
{
}
#pragma CODE_SEG DEFAULT
//====================================
#pragma CODE_SEG NON_BANKED
interrupt ((0xFE-0xA2)/2) void can2Rx_ISR(void)
{
}
#pragma CODE_SEG DEFAULT
//====================================
I would like also to direct you to an example XEP100-INT-INTERRUPTNUMBER-CW51
#define SET_CPU_PRIORITY(vec_adr, priority) \
INT_CFADDR= (vec_adr) & 0xF0; \
INT_CFDATA_ARR[((vec_adr) & 0x0F) >> 1]= (priority)
#define PIT0 0x7A // vector address
Code:
…
…
SET_CPU_PRIORITY(PIT0, 1); // set to HW priority and the lowest level
…
…
SET_CPU_PRIORITY(PIT0, 4); // change HW priority level
…
…

Note, another example usinf TRAPPROC as definition of the interrupt together with interrupt function vector defined in the prm file (at the bottom of the file) can be seen in XEP100-INT-TRAPPROC-CW51
Which presents how to set interrupt priority level from 0 to 7. Let’s mention that level 0 disables interrupt even it is enabled in the control register of given peripheral.
The easiest way is to use vector table from the reference manual and use following principle:
If this does not answer your question(s), or I have forgotten something, or if you need more assistance, please contact me again.
- This issue will auto close in 7 days upon no reply.
Best Regards, Ladislav