liveBook · Manning

Interrupt handler

As explained in Robotics for Programmers

An interrupt service routine is a predefined function executed in response to an interrupt.

An interrupt handler, or interrupt service routine (ISR), is a predefined function that runs when hardware or software signals an event. In a robot, it lets urgent events such as bumper presses, stop-button activation, or timer expiry interrupt the currently running program instead of waiting for polling. section 3.5

The interrupt path has three practical concerns:

  • The interrupt source signals an event, either externally through hardware or internally through the system. section 3.5
  • The CPU and operating system switch from the current task to the ISR, introducing interrupt latency. section 3.5
  • Variation in that latency is jitter, which matters when robot reactions must be predictable. section 3.5
#1
input.on_change(True, do_something)

Compare event-driven input handling with cyclic polling: register a callback so the system invokes the handler when the input changes. section 3.5

How Robotics for Programmers covers it

How deep it goes
Explains triggering, task switching, latency, and jitter, but defers synchronization and inter-process communication details.
Examples
Uses bumper switches, stop buttons, hardware timers, polling loops, and input-change callbacks as examples.
What you can do after
Operate event-driven robot inputs while recognizing the timing costs and variability of ISR dispatch.
How it connects
Connects interrupts with timers, polling, schedulers, real-time operating systems, interrupt latency, and jitter.

Also explained in

Compare how 2 books explain interrupt handler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Robotics for Programmers. The section links point to the parts of the book it draws on.