I've written an SPI ISR for a dsPIC33FJ12MC201. I would like to know how to determine the Worst Case Execution Time (WCET) for that code (or at least a reasonable approximation) . I'm using the free version of MPLAB. Nested interrupts are not allowed.
The clock code setup is:
#ifdef XTAL
#pragma config FNOSC = PRIPLL // Primary Oscillator (XT, HS, EC) w/ PL
#pragma config POSCMD = XT // XT Oscillator Mode
#pragma config IOL1WAY = OFF // Allow Multiple Re-configurations
#else
#pragma config FNOSC = FRCPLL // Internal Fast RC (FRC) w/ PLL
#pragma config POSCMD = NONE // Primary Oscillator Disabled
#pragma config IOL1WAY = OFF // Allow Multiple Re-configurations
#endif
void init_clock(void) {
#ifdef XTAL
SetPreDiv(5); // 10MHz / 5 = 2MHz
SetPLLdiv(72); // 2MHz * 72 = 144MHz
SetPostDiv(2); // 144MHz / 2 = 72MHz
#else
//
// 7.372800 MHz + 25 steps of 0.375% = 8.064000MHz
//
SetOscTun(25); // 9216 * (800 + 3 * 25) = 8064000
SetPreDiv(7); // 8064KHz / 7 = 1152KHz
SetPLLdiv(125); // 1152KHz * 125 = 144MHz
SetPostDiv(2); // 144MHz / 2 = 72MHz
#endif
}
The internal oscillator is being used, not an external XTAL. I *think* the comments in initclk() are correct, if not please could you put me straight.
Thank you, David