What is Super loop?
A firmware structure without an OS in which an infinite loop in main calls each task in turn, with urgent work done in interrupts.
Japanese name: スーパーループ
A firmware structure without an OS in which an infinite loop in main calls each task in turn, with urgent work done in interrupts.
Japanese name: スーパーループ
At start-up the firmware initializes the clocks and peripherals, then keeps calling functions for reading inputs, computing and driving outputs in turn inside while (1). Time-critical work is done in interrupt handlers, which pass their results to the loop through flags or small buffers. Viewing the interrupts as the foreground and the loop as the background, the structure is also called a foreground/background system. Periodic tasks decide when to run by checking a tick count incremented by a timer interrupt.
In the worst case, a task in the loop notices a request only after one full pass of the loop. If one task waits for a long time, every other task is delayed, so tasks that involve waiting are split into state machines that return quickly on each call. Variables shared with interrupts are declared volatile, and interrupts are briefly disabled when multi-byte values are read or written together. Resetting a watchdog timer once per pass of the loop makes it possible to detect that processing has stalled.
A super loop needs no memory or processing time for an OS and is easy to follow, so it suits small microcontrollers and simple devices. Putting the processor to sleep at the end of the loop when there is no work also reduces power consumption. However, as the number of tasks grows and tasks with different deadlines must be switched according to priority, the loop design becomes complicated. At that point, adopting an RTOS, which can switch tasks preemptively, is worth considering.
Answer: A. An infinite loop in main calls each task in turn forever, with urgent work handled by interrupts
In a super loop, after initialization, a "while (1)" loop keeps calling tasks such as reading sensors, computing and updating a display in order. Time-critical work is done in interrupts, which notify the loop with flags. It needs no OS, uses little memory and is easy to follow. But if one task takes long, everything else is delayed, so an RTOS is considered when the work grows complex.
Building real circuits is a good way to check what you learned in the questions.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.