Subsection 8.2.1 Part 1: Why a Background Timer
While
ADCPot.c sits in its delay_ms(1000), the CPU idles through 12,000 clock cycles every millisecond. You noticed the same thing in the Lab 2 race game: button presses during the countdown delays could slip past unwatched. A timer that counts in hardware turns the relationship around: timekeeping costs the CPU nothing, and the CPU’s whole attention is available for work: sampling a sensor at fixed intervals, timestamping events, running a control loop at a steady rate. We’ll come back to these timers in two weeks: they’ll hold output pins high for precisely controlled durations (that is how motors get their speed commands).
