Embedded Systems & Firmware

On a microcontroller with interrupt priorities, a higher-priority interrupt occurs while a lower-priority handler is running. What generally happens (assuming nesting is allowed)?

  1. AThe low-priority handler is suspended, the high-priority handler runs, and then the low one resumes
  2. BThe high-priority interrupt is discarded until the low handler finishes
  3. CBoth handlers execute in parallel on the same CPU at once
Show answer and explanation

Answer: A. The low-priority handler is suspended, the high-priority handler runs, and then the low one resumes

With interrupt priorities, an urgent interrupt is serviced even while another handler is running. For example, if motor overcurrent detection has high priority and communication reception low priority, overcurrent can be handled at once even mid-reception. Arm Cortex-M's NVIC and others provide this mechanism. Interrupts of equal or lower priority wait until the current handler finishes.

  • A. Correct. This is called interrupt nesting.
  • B. It is serviced immediately, not discarded.
  • C. One CPU executes one thing at a time.
Practice this topic Back to topic

More Embedded Systems & Firmware questions

  1. In C, which statement sets only bit 3 of register reg to 1 without changing the other bits?
  2. In C, which statement clears only bit 3 of register reg to 0 without changing the other bits?
  3. To toggle an LED output pin bit between on and off each time the code runs, which C statement is correct?
  4. Which C condition correctly tests whether bit 5 of input register in is 1?
  5. The code above rewrites a multi-bit field of register reg. What does it do?