Timers are one of the essential components of a microcontroller, along with GPIOs. Controllers use timers for hundreds of tasks, but manufacturers also make them available to users. Developers can set up a time-based ISR to guarantee that a task is executed at the same time interval without calculating delays, timers can also be used for sleep modes, timestamp generation and many other tasks.
A timer's clock signal can be scaled down using the prescaler, practically slowing down the counting. Possible values are given in the documentation of the device used. Usually, the developer only specifies a frequency or resolution from which the IDE calculates the prescaler. A 16-bit prescaler is minimum 1, maximum 65535.
$ f_{\text{timer}} = \dfrac{f_{\text{clock}}}{\text{Prescaler}} $
Incorrectly written code will be prevented from being uploaded by the compiler, but if the project does not contain typos, incorrect data types or other problems, the program will be uploaded to the controller without any problems. If the CPU gets stuck at runtime due to bad code or hardware failure and can't do anything else, it needs to be restarted. It is the watchdog timer's job to watch for such a stuck and restart the system.
The use of pulse-width modulation is very diverse. It is based on very fast on/off switching, but it is not the amplitude (AM) or frequency (FM) of the signal that changes, but the ratio of low to high signals. The name of the ratio is duty-cycle, usually given as a percentage. The I-V curve of an LED does not allow the brightness to be controlled by varying the voltage and current. However, using PWM, the brightness of an LED driven with a 30% duty-cycle signal is perceived by the human brain as 30% brightness because the human vision includes a natural low-pass filter. Inverters, battery chargers, motor controllers all use PWM for their operation.