Interrupt handlers uncovered

What are interrupt handlers or interrupt service routines, in fact?
It is like when someone knocks at your door and it is you who answer.
Hey! Is your dad home? … he asks you. Then you go to your dad to tell him that someone is asking for him, you are interrupting him from his daily activities (eating pop-corn, watching football games, stuff like this).
That guy asking for your dad (who takes place of a CPU) is like a peripheral requesting a service. You are the handler, because you tell your dad which guy dares to disturb him :)s

In any case I think for the majority of embedded systems engineers, whether they work in the applications  design, whether they are testers, this is a very familiar term. Actually many interviewers are asking their candidates if they know how to code interrupt service routines, what are those good for, what is it interrupt latency, what’s the difference between an ISR (interrupt service routine) and a common subroutine.

Usually the interrupt vector table contains many entries generally split into two categories, traps or exceptions and interrupt service routines. First ones are associated with software interrupts, second ones with hardware interrupts and they will make the subject of this post.

Basically external software interrupts are generated by an external (I mean peripherals) piece of hardware which requests some CPU time or some memory (the two commodities in embedded systems, but I suppose in computing in general). They are very important in embedded programming due to the fact that they represent the way in which the system is communicating with external devices. All microcontrollers nowadays are armed with various communication interfaces such as SPI, CAN, I2C, RS232, all of those will be completely useless if interrupt requests made by one of them would be handled in an incorrect manner.

The sensitive part of interrupt handler is that they execute code in privileged mode, in other words one must be aware that a bug hidden within an ISR can cause serious damages to the systems.

Read more of this post