AVR interrupt response time

Jan 12, 2005 20 Replies

Shortly checked the -ffixed-rn option It is "accepted" by the compiler...but not quite sure if a got what I wanted. Need to do some testing...bevause this is what I want to do. See below.

Conversation about this issue is over. But just in case someone is interested how things are developing... I did think about optional solutions and now I do really have them.

  1. The one Mike suggested; manipulating the assembler gcc generates
  2. Writing all (at least interrupt handlers) in assembler.
  3. In-line assembly...and 'naked' attribute
  4. ....

Well I did try options 2 and 3 using Mega8 running at 14.7456MHz.

OPTION2:

.global SIG_INTERRUPT0 SIG_INTERRUPT0: cbi _SFR_IO_ADDR(PORTB), PB0 sbi _SFR_IO_ADDR(PORTB), PB0 reti

It takes less than 0.6 us to start my own handler code. As both cbi and sbi take 2 cycles, line PB0 got back up within 0.8 us.

OPTION3: I defined new kind of signal handler type:

#define NAKED_SIGNAL(signame) \ void signame (void) __attribute__ ((signal,naked)); \ void signame (void)

NAKED_SIGNAL(SIG_INTERRUPT0) { cbi(PORTB,0); sbi(PORTB,0); }

Exactly same kind of timing as in option 2. Which is natural as naked makes gcc to generate fully empty handler function. No prologue code, nothing...not even reti!

So, with both options I was able to get

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required