O'Reilly logo

Embedded C Programming by Mark Siegesmund

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18

Timers/Counters

Abstract

The chapter covers in detail the counter and timer peripherals found on most microcontrollers. Diagrams of the peripheral with all the possible options such as gates, multiplexers, pre-scalers, and post-scalers are shown and explained.

Many C examples are included, with the math used to calculate various characteristics. This chapter also shows how timers and counters are integrated with interrupt processing. The concept of a virtual timer created with software is also included.

This chapter includes a detailed example of using a timer and interrupt to control a relay on the zero-crossing of an AC source.

Examples and exercises are for the popular PIC® microcontroller manufactured by Microchip.

Keywords ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required