PWM (Pulse Width Modulation) Setting the Inverted or Non-Inverted Output Mode and Determining the OCR Value
Inverted mode is where the pulse happens at the end of the period. Non-Inverted mode is where the pulse happens at the beginning of the period.
In inverted mode, the signal will jump up to 5v (creating the start of the pulse) when the timer/counter hits the OCR1A (Output Compare Register) value. In non-inverted mode, the signal starts at 5v and jumps down to 0v when the timer/counter hits the OCR1A value.
To set the output mode to inverted mode, the COM1A1 and COM1A0 bits are set.
To set the output mode to non-inverted mode, the COM1A1 bit is set, but the COM1A0 is not set.
If the OCR1B is desired rather than the OCR1A, the use the COM1B1 and COM1B0 instead.
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.