2 The Smart “Things” in IoT
89
Fig. 2.32 Base-indexed indirect addressing mode
2.5.7 Timers
In any microcontroller, the timer is one of the most important features. Timers
have many use cases. For example, they can be utilized to generate accurate time
intervals enabling users to control code and complete tasks that are dependent on
time. Timers are also used to create delays, change servo shaft angles, set baud
rates, sample analog signals, or turn a device on or off after a given period of time.
In general, you can find a timer subsystem managing a broad range of functions in
all microcontrollers, e.g.:
• Producing accurate time intervals
• Measuring the length of external events
• Counting events
Microcontrollers contain exclusive timers or general-purpose timers that handle
the following functions:
• A real-time clock
• Creation of pulse width modulated (PWM) signals
• As watchdog to automatically reset the system if the main program neglects to
periodically service
The most important time in Cortex-M is SysTick timer. SysTick is a 24-bit system
timer that is part of standard hardware for the ARM Cortex-M series. Figure 2.33
illustrates the block diagram of a typical system timer. As depicted in this figure,
system timers include three registers:
• SYST_CVR: This register stores the current SysTick counter value.
• SYST_RVR: This register indicates the starting value of the counter which
should be loaded to SysTick.
• SYST_CSR: This register manages and controls the SysTick features.
89
Fig. 2.32 Base-indexed indirect addressing mode
2.5.7 Timers
In any microcontroller, the timer is one of the most important features. Timers
have many use cases. For example, they can be utilized to generate accurate time
intervals enabling users to control code and complete tasks that are dependent on
time. Timers are also used to create delays, change servo shaft angles, set baud
rates, sample analog signals, or turn a device on or off after a given period of time.
In general, you can find a timer subsystem managing a broad range of functions in
all microcontrollers, e.g.:
• Producing accurate time intervals
• Measuring the length of external events
• Counting events
Microcontrollers contain exclusive timers or general-purpose timers that handle
the following functions:
• A real-time clock
• Creation of pulse width modulated (PWM) signals
• As watchdog to automatically reset the system if the main program neglects to
periodically service
The most important time in Cortex-M is SysTick timer. SysTick is a 24-bit system
timer that is part of standard hardware for the ARM Cortex-M series. Figure 2.33
illustrates the block diagram of a typical system timer. As depicted in this figure,
system timers include three registers:
• SYST_CVR: This register stores the current SysTick counter value.
• SYST_RVR: This register indicates the starting value of the counter which
should be loaded to SysTick.
• SYST_CSR: This register manages and controls the SysTick features.
