You are signed in. Close

You are signed out. Close

Thank you. Your subscription has started. Close

Thank you. You will get an email when a new comic comes out. Close

We could not confirm your payment. If you paid, use the link "Sign in" at the bottom of the page. Close

Something went wrong on our side. Please try again in a moment. Close

Previous episode Sensors and actuators: how a tiny computer feels and moves the world

How embedded systems work: the hidden computers in everyday things, and how engineers build them

Firmware: the program that runs in an endless loop inside a device

Your laptop starts programs and closes them all day. The small computer in a washing machine or a cat flap runs one program from the second it gets power, and that program never stops, not even at night.

  1. 1 Rono puts the cover back on. Nobody presses a button and nothing asks for a program, yet the flap is already at work.++++blinkRono

    Rono puts the cover back on. Nobody presses a button and nothing asks for a program, yet the flap is already at work.

  2. 2 The moment power comes, the chip starts the one program kept in its storage. That program is the firmware. It lives in flash, a storage that keeps it, and the list of known cats, even with no batteries.+powerflash, the chip's storagethe firmwareknown cats:Miva's cat

    The moment power comes, the chip starts the one program kept in its storage. That program is the firmware. It lives in flash, a storage that keeps it, and the list of known cats, even with no batteries.

  3. 3 The firmware does one thing, over and over: it looks for a cat in the tunnel, reads its number, and opens only for Miva's cat. Then it starts again from the top, thousands of times a second, and firmware writers call it the main loop.a cat here?read its numberMiva's cat?open, wait, closethe main loop

    The firmware does one thing, over and over: it looks for a cat in the tunnel, reads its number, and opens only for Miva's cat. Then it starts again from the top, thousands of times a second, and firmware writers call it the main loop.

  4. 4 The grey cat tries first, and its number is not on the list, so the latch stays shut. A minute later, Miva's cat comes home, and the flap opens for it.not on the liston the list

    The grey cat tries first, and its number is not on the list, so the latch stays shut. A minute later, Miva's cat comes home, and the flap opens for it.

  5. 5 Rono does a sum: with a reader that sends its waves all night and a loop that never rests, four batteries would be flat in a few days. Yet the box says up to a year. How?reader onall night+flat in a few daysup to a yearon 4 batteriesRonoyou

    Rono does a sum: with a reader that sends its waves all night and a loop that never rests, four batteries would be flat in a few days. Yet the box says up to a year. How?

  6. Quick check

    Four batteries out, then back in.Miva takes the batteries outof her flap for a minute, thenputs them back. Does the flapstill let her cat in?++++

    Four batteries out, then back in.

    Show the answer

    Yes. The firmware and the list of known cats are kept in flash, which keeps them with no power.

  7. Go further

    Where the work in progress goes, and two old words.4417RAMthe chip's memory for thework in progress, like thenumber it just read. Itforgets all when the powergoes, so the list of catslives in flash"firmware""firm": it sits between thehardware (the chip and itswires) and software (theprograms you install). Yourarely change itsuperloopanother name for a mainloop that does everything,with no other programaround it

    Where the work in progress goes, and two old words.

Next episode Interrupts and sleep mode: how a battery device can watch all night for a year

Share this comic

More comics