Go Down

Topic: External Interrupt ISR Execution Latency (Read 1 time) previous topic - next topic

renniejohnson

Is there any way to estimate the time it takes for an ISR() interrupt routine on an external interrupt pin to begin execution?  The interrupt calls this function:

Code: [Select]
void LED_V3::StartTimer()
{
  TCCR1A = 0;        // reset timer 1
  TCCR1B = 0;
 
// set up Timer 1
  TCNT1 = 0;         // reset counter

 
  OCR1A =  m_timerCounter;       // compare A register value


  TIFR1 |= _BV (OCF1A);    // clear interrupt flag
  TIMSK1 = _BV (OCIE1A);   // interrupt on Compare A Match 
}


My setup:
Arduino Nano 3.0 w/ATmega 328
Interrupt Input on Pin 2 (Trigger On Input Low)

PaulS

Quote
Interrupt Input on Pin 2 (Trigger On Input Low)

This means that your ISR will be called over and over as long as the pin is LOW. Is this really what you want? Or do you really want FALLING?

renniejohnson

No, that wouldn't be good.  "Falling" it is.

Still need help on time calculations.

bill2009

There's an excellent writeup linked to by a thread On this site - search for interrupt latency maybe. I believe the basic answer is several microseconds but there are ways to improve it.

renniejohnson

Bill:

Thanks for the response.  I didn't find the link on a search, but I did fine this third party post:

http://billgrundmann.wordpress.com/2009/03/02/the-overhead-of-arduino-interrupts/

I'd like to know about the methods of improving latency.  I'll bet it involves writing assembly language (I suck at that!).

Also, do you think the delay will be consistent on each iteration?  Even if it's 5 microseconds, I can deal with it if it's always the same.


Go Up