Hello Susan and "NorthGuy"
Here in attached file I show the principle of my programm (for DSPIC33FJ)
- the main function does not do anything but initializations
- there is a function which uses the DSP engine. Before any computation, the DSP must be configured (Macro A = unsigned integer)
- there are 2 Interrupt functions: ADC (priority = 3) and PWM Match (Priority = 6) These two functions use the DSP engine too, but with another configuration (Macro B= signed fractionnal SQ1.15), and call the mentioned function
If I don't put the IPL at 7 in the function before the macro (I restore it after the DSP computation), an interrupt may occur after the Macro A. In the interrupt, the DSP will be configured with the Macro B, and the good configuration will not be restore for the computation in the function.
Without this configuration issue, I must admit that I would disable interruptions before any DSP computation (in anassembler file), because I'm not sure that RCOUNT and Working Registers will be restored at the return of an interruption. Can you tell me exactly what is restored by the compiler (XC16) at the return of an interruption ?
Down here an example of my interrupt function prototypes:
void __attribute__((__interrupt__,__no_auto_psv__)) _CNInterrupt(void);