6

Using Hardware Timers

We use timers to determine when we want a period of time to elapse before an action takes place, which can be incredibly useful. For example, you can set an interrupt to trigger when a timer reaches a certain value. Timers operate in the background; while the microcontroller runs your code, the timers are counting away.

In this chapter, you’ll learn about:

  • • Various timers in your ATmega328P-PU microcontroller
  • • Timer overflow interrupts
  • • Clear Timer on Compare Match interrupts

I’ll show you how to run parts of code on a regular basis, create longer delays for repetitive actions, and examine the accuracy of internal ...

Get AVR Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.