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
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). The ISR 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.
So as we can see, using an ATtiny85 processor running at the
internal resonator speed transmitting a serial bit stream at 4800bps
there's very little time to do any real work which still can be
OK in many applications.
You can actually improve this a lot by using the compiler's optimising
options so that's my next
tip.
|