4. The Timer Device

In the previous chapter, we discuseed basic binary input and output pins. We mentioned how busy polling is wasteful of processor resources. For most applications, continuous sampling of a pin is not required. Sampling a pin ``once is a while'' is often appropriate. ``Once in a while'' here translates to tens of milliseconds to even hundreds of milliseconds.

In this chapter, we discuss how this can be done. Sampling at a certain frequency is one of the many possible applications of a timer device. Modern MCUs often include at least one timer devices on the same chip with the processor and other components. Each timer operates in parallel to the processor itself, and most of the time timers are independent of each other in an MCU with multiple timers.



Subsections

Copyright © 2006-02-15 by Tak Auyeung