Conceptual
Login

Interrupt Service Routine

An ISR is the function the hardware calls when its interrupt fires, preempting the main program, so it must be short, avoid blocking calls, and exchange data with the main loop only through volatile variables read atomically. Work beyond a few instructions belongs in the main loop, signalled by a flag the ISR sets.

Questions this Concept answers

  • Why is an interrupt service routine expected to do the smallest possible amount of work?