IntermediateTopic 60 of 104Electronics & Embedded

Interrupts

Hardware signals that pause the main program to run a handler.

In depth

An interrupt signals an event, saves context, runs an ISR and returns. Vectors map sources to handlers; priorities and nesting resolve conflicts. Keep ISRs short, use volatile flags and avoid blocking calls. Latency determines real-time capability.

Key points

  • Edge vs level triggered
  • Debouncing
  • Critical sections disable interrupts
Example

A UART receive interrupt stores a byte in a buffer.

Why it matters

Interrupts let a device get the processor's attention immediately, so systems can respond to events without constant polling.

Where this is used

  • Handling a button press without polling the input in a loop.
  • Receiving a byte from a serial port as soon as it arrives.
  • Reacting to a timer overflow to update a control loop.

Frequently asked questions

What is Interrupts?

Hardware signals that pause the main program to run a handler.

Why is it important to understand interrupts?

Interrupts let a device get the processor's attention immediately, so systems can respond to events without constant polling.

What should an interrupt handler do?

It should do the minimum work, such as clearing the flag and saving data, and leave longer processing to the main program.

Why must interrupts be carefully managed?

Shared data can be corrupted if an interrupt changes it during main code, so critical sections and volatile variables are needed.

How is Interrupts used in practice?

Typical applications include handling a button press without polling the input in a loop, receiving a byte from a serial port as soon as it arrives and reacting to a timer overflow to update a control loop.

What should I learn before Interrupts?

Study "Cache memory" first (topic 59 of 104 in Electronics & Embedded). It covers the groundwork this topic builds on.

What are the key points of Interrupts?

Edge vs level triggered. Debouncing. Critical sections disable interrupts.

Can you give an example of Interrupts?

A UART receive interrupt stores a byte in a buffer.

What comes after Interrupts?

The next topic is "GPIO", which builds directly on this one.

How difficult is Interrupts?

It is classed as Intermediate in Electronics & Embedded (topic 60 of 104). It is an intermediate topic. Work through the beginner topics in Electronics & Embedded first.

Learning path

Want to practise? Open the interactive course for quick checks, quizzes, simulations and progress tracking.

Related topics