The embedded paradigm

Programming a constrained machine: main loop with no operating system, interrupts and flags, real-time kernels and deadlines, registers and bit masks, energy budget and watchdog.

  • 25 cards
  • 5 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. The numbers
  5. Scenarios

A few cards from the deck

  • Interrupt: what is it?

    Show the answer

    A hardware signal that suspends the running program to run a dedicated routine right away, then resumes where it left off.

    It avoids polling a button or a sensor in a loop. The routine must stay short: while it runs, the rest of the program is stopped.

  • What is reg after these C lines?

    ```c
    unsigned char reg = 0x41;
    reg |= (1 << 5);
    `

    • 0x61
    • 0x20
    • 0x46
    • 0x40
    Show the answer

    0x61

    1 << 5 is 0x20 (bit 5). The OR sets that bit to 1 without touching the others: 0x41 | 0x20 = 0x61. reg = 1 << 5 would have given 0x20, erasing the rest.

  • An interrupt routine just sets a …; the … then does the real work.

    Show the answer

    An interrupt routine just sets a flag; the main loop then does the real work.

    The routine must be short, with no waiting or printing. The shared flag must be declared volatile, otherwise the compiler may never re-read its value in the loop.

  • Real-time constraint: what is it?

    Show the answer

    A requirement that a computation finish before a set deadline; the time of the result matters as much as its value.

    “Fast” is not enough: the duration must be bounded in the worst case. Hard, missing it is a failure (airbag); soft, it only degrades quality (video).