21489 Timer Interrupts


When I execute code that uses Timer Interrupts and a delay is used to allow interrupts to occur the number of interrupts counted is very close to the expected value. An example of this is shown below;

   Core clock frequency 331,776,000Hz = 3.014nS period

   Number of cycles between Interrupts = 5000

   Time between Interrupts 3.014nS*5000 = 15uS

   Delay in the code is set to approximately 1 second

   Estimated Interrupts in 1 second 1/15uS = 66355

   Interrupts counted during code execution 64319

All good so far.

Now if I remove the delay and add a statement to Read and Store a reading from the SPORT port (adcCode0 = *pRXSP0A & 0x00FFFFFF;).

The code takes 4000 readings and the converter is configured for 4000 reading/second. Code takes 1 second to execute, same as the delay.

The Timer Interrupt count is just over 4000 for the same time interval. (timer_isr_count1 int 4029)

What am I missing, why is the Time Interrupt count so different when I read from the SPORT interface?