You are here

Changing the duty cycle of PWM | Cypress Semiconductor

Support & Community

Changing the duty cycle of PWM

Last Updated: February 27, 2011

How do I change the Duty Cycle of a PWM?


Duty Cycle of PWM can be modified by writing the desired value to the Period Register or the Compare Register. The duty cycle in % is given by the following formula.

Duty Cycle = (Compare Value / Period Value) * 100

To prevent glitches on the PWM output, the compare value register should be updated only when the PWM is stopped or when the PWM has reached the zero count.

Knowledge Base Tags: 

Provide feedback on this article

Browse KB By Product

Browse KB by Type