Hi Xiangjun,
Thanks for your suggestion. #pragma interrupt on slightly reduces the delay. If you can tell me any other way of further reduce the delay that would be great.
In another ISR , ADC High Limit Interrupt, I am trying to read the ADC value at a specific point (please see the attached figure- I am trying to read the minimum value). I am using the following simple code to read the ADC result when the interrupt happens (Sample 0 > 0.85 V). However, I am reading multiple values (gradually increasing) instead of just one when the interrupt happens. Also the values are changing all the time. I am using a structure named adc0_array to save 100 values. Will you please let me know where is the problem?
Thanks. Rishad

SIM_PCE0 |= 0x1<<6; // Enable GPIOA clock
GPIOA_PER = 0x00FFU; // PER Enable for GPIOA 0-7
SIM_PCE2 |= 1<<7; // enable clock to ADC modules
ADC_CTRL1 = 0x2105;
ADC_CTRL2 = 0x1804U;
ADC_CLIST1 = 0x3210U; // SAMPLE3 - ANA3, SAMPLE2 - ANA2,SAMPLE1 - ANA1, SAMPLE0 - ANA0
ADC_SDIS = 0xFEFEU; // enable ADC channels 0&8 -> ANA0 (pin 22), ANB0 (pin33)
ADC_PWR = 0x01A0U; // power-up delay set to 26 clocks
ADC_HILIM0 = 0x431 << 3; // High limit threshold
/* Enable high limit interrupt - priority 1 */
INTC_IPR2 |= 1<<13;
for(;;) {
ADC_CTRL1 |= 1<<13;
}
#pragma interrupt alignsp
#pragma interrupt on
void ADCA_Ch0_HighLimit_ISR() {
adc_array* pAdc0_array = &adc0_array;
adc0_array.array[adc0_array.c] = (0x7ff8 & ADC_RSLT0) >> 3;
adc0_array.c++;
ADC_HILIMSTAT = 0xFFFF;
}