3.9 Periodic Task Timer (Heartbeat)

To signal various events, a “heartbeat” timer was used to generate a periodic interrupt at a known frequency. This timer effectively serves as the heartbeat of the system – state machines are updated, values are measured and complex tasks are staged to run. This timer could be implemented by any of the built-in timers, but this example uses Timer0 at a frequency of 1 kHz.