PWM (Pulse Width Modulation) General Discussion on Using an 16-Bit Timer Create a PWM
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.
Comments and Additional Information
Have some code to share? Or additional information? Respond here:
You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.