home  general  lard  emul8or  ArdweeNET  MAXX  the QUUB  Gecko  SiiMAN
        embedded systems  PC software

I won't explain all this again, see tip 01 for the initial explanation.

Note the green part, that's the main() routine trying to do some work, in this case I'm just pulsing a spare I/O line so I can see what's happening. As we can see we get 5-6 pulses in before the timer interrupts to tell us it's time for another bit to go out the serial line.

The yellow(ish) part in the middle is the ISR deciding what bits to stuff out the serial line (the top trace is the actual serial output). This takes 81uS.

The two red parts are the processor entering and leaving the interrupt. Of course this code is written in C so there is a lot more overhead for a call than in assembler. This takes 67uS in total, almost as long as the ISR.

Can we improve this by using the compiler's optimising options? In AVR Studio I set the option to -Os, the maximum.

Now let's see what happens.

I won't add the coloured bits this time, I'm sure you can see what's going on.

Now notice now much work main() gets done, 8-9 pulses, that's about a 50% improvement.

The ISR now only takes 56us as opposed to 81, and the interrupt overhead is now only 52uS whereas it used to be 67.

That's go to be worth doing.

Top of Page


  home  general  lard  emul8or  ArdweeNET  MAXX  the QUUB  Gecko  SiiMAN
        embedded systems  PC software

Copyright © 1973-2013 Rob Gray, All rights reserved.
PO Box 450, Gin Gin, QLD, Australia.