From the course: Introduction to Embedded Systems with Rust

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Timers

Timers

- [Instructor] Timers are used to measure the amount of time that has elapsed. For example, when you put a thread to sleep, a timer used to set the duration of the sleep, which is the amount of time that must elapse before it wakes up. Timers are driven by a clock. Many microcontrollers and general-purpose computers have multiple timers. The embedded system we are using has four general-purpose timers. They can operate in both a 16-bit and 32-bit configuration and can count in both directions, and they have some magic thing called a prescale factor. Let's look into the detail of these three things. The direction, the resolution, which is the number of bits, and the prescaler. The direction is an obvious one. If we need to count upwards from a value, we need a timer that can count upwards. The opposite is of course true. There's not much else to it. The timers on our embedded device can count in both directions, but it is common to have timers that can count in only one direction. The…

Contents