lesson

Updated 6 days ago ยท 1 view
Imagine sitting by your front door staring through the peephole every five seconds just in case a delivery arrives. You would get almost nothing else done all day.
In embedded systems, microcontrollers face the exact same choice: constantly ask peripherals if they have new data, or let the hardware ring a digital doorbell.
Cyclic Polling
Cyclic polling is a control method where the central processor periodically reads a peripheral's status register in a software loop to check if an event has occurred.
Because the central processing unit (the CPU, the chip's main calculation brain) executes instructions to read and compare register bits over and over, most processor cycles are wasted reading empty flags.
๐Interactive diagram
How much time elapses between an external event occurring and the processor actually responding?
Latency and Missed Signals
Latency is the time delay between the moment an external hardware signal changes and the moment the CPU executes the first instruction to service that event.
In a polled system, if your main loop takes Tloopโ seconds to execute, the worst-case polling latency is Tlatencyโ=Tloopโ.
If an external input pulse is shorter than Tloopโ, the signal can rise and fall completely between checks, causing the microcontroller to miss the event entirely.
๐Interactive diagram
What if the hardware could force the processor to pause its current work the exact microsecond a signal appears?