dsPIC interrupts and xc16 compiler

Thread Starter

odm4286

Joined Sep 20, 2009
265
Hello all, played around with interrupts for the first time and I have a question. I'm having a little trouble/curiosity with how ISR are assigned. Here is my interrupt routine(I know I broke some rules here, calling functions from within, etc etc)
C:
void __attribute__ (( __interrupt__ )) _ADCInterrupt (void)
{
    sprintf(data, "%d", ADCBUF0);
    IFS0bits.ADIF = 0;                                  // clear interrupt flag
}
Now see where it says _ADCInterrupt? Well, the dsPIC3014 datasheet lists 0x00002E as the IVT for this peripheral. Is it possible to use this address somehow? That way I'm not always dependent on a compiler specific constant? Also, I've searched around in the xc16 datasheet and can't seem to find a list of interrupt constants...

So any explanation would be greatly appreciated, I'm understanding the theory of interrupts so far I just wish I knew more about how they are assigned.
 
Last edited:

Thread Starter

odm4286

Joined Sep 20, 2009
265
The datasheet has a list of memory addresses, but not the actually constants the compiler uses to assign ISR's to a specific peripheral interrupt. You can't use a memory address in place of the constant _ADCInterrupt, at least not on my compiler
 

dannyf

Joined Sep 13, 2015
2,197
Constants like _T1Interrupt is automatically resolved in the corresponding .gld files.

Code:
That way I'm not always dependent on a compiler specific constant?
It is always more desirable to use the compiler-dependent names, vs. some magic numbers you may put there - the addresses may change from device to device and it is much harder to remember that _T1Interrupt() is a timer1 interrupt, rather than 0x00002E.
 
Top