IT lexicon › Hardware › Interrupt service routine (ISR)

Interrupt service routine (ISR)

Hardware På svenska → Updated: 2026-11-03

The function the processor jumps to when an interrupt fires — code that runs on borrowed time, in the middle of something else.

Its address comes from the interrupt vector table. On Cortex-M an ISR is a plain C function, because the hardware stacks the caller-saved registers itself in an exception frame; older architectures needed an assembly prologue or a compiler-specific __interrupt keyword.

The ground rules are universal: keep it short, never block, clear the interrupt flag before returning (or it fires again immediately), and share data with the main program through volatile variables or a critical section. Heavy lifting gets handed to a task — see deferred interrupt handling. FreeRTOS has separate …FromISR() calls precisely because the regular API may try to sleep, which an ISR must never do.

← Back to the lexicon