
38/317
2 - How does a typical microcontroller work?
reading the first bytes of the data, then the interrupt occurs; on return, the remainder of the
data are read, but unfortunately there may not be coherence between the first byte that was
read before the interrupt and those read after it.
2.5.3 Conclusion: the benefits of interrupts
The interrupt system is a very appropriate means of processing events that have the following
features:
They are triggered by a hardware signal coming from outside. Theses signals are connected
to appropriate pins of the microcontroller; or they are the result of the working of internal
peripherals that reach a certain condition, for example the internal timer has overflowed.
Though the timer is built-in the same chip as the core, it is functionally considered external
to the core.
They occur at their own time, and thus unexpectedly for the main program.
They require a quick reaction from the core, either because they occur frequently or because
the status of the external device that requests the interrupt would not keep its meaning after
too long a delay.
They do not require complex processing; typically, they require reading some data from
outside and storing it to memory, or transferring data from the memory to the external
circuitry.