PWM (Pulse Width Modulation) General Discussion on Using an 16-Bit Timer Create a PWM
Share
This video specifically applies to hobby servo control, but is a good discussion on using the 16-bit timer to create a PWM. The period can be created using the 16-bit timer overflow at 65535, or the ICR (Input Capture Register) can be used as the top of the timer count so the timer overflows at the value given to the ICR. This allows for a very precise PWM period. The OCR (Output Compare Register) is used to start the pulse. When the overflow, or the ICR is hit by the timer/counter, the pulse ends and the signal goes to 0v.