Software timers
This section describes software timers, and it presents an example-program that uses software timers. Also, guidelines are presented for using software timers.
Understanding software timers
Just like the name states, software timers are timers that are implemented with software. In MCUs, it is extremely common to have many different hardware-peripheral timers available. These are often high resolution and have many different modes and features that are used to offload work from the CPU. However, there are two downsides to hardware timers:
- Since hardware timers are part of the MCU, you’ll need to create an abstraction above them to prevent your code from becoming tightly coupled to the underlying MCU hardware. Different MCUs will have slightly different implementations for timers. Because of this, it is easy for code to become dependent on the underlying hardware.
- Hardware timers will generally take more development time to set-up than...