The PWM duty cycle is independent of the input frequency.
Duty Cycle in % = 100 * Period / Compare value
Both values can be changed by APIs, see the PWM datasheet.
Thanks Bob for reply
i want to generate a pwm dutycycle 20% to 90% but these below apis
given the same waveform output that is it's not working.
according to your formula Duty Cycle in % = 100 * Period / Compare value
but it's not working.
Please help me to resolve the issue.
Thnbaks in advance.
i want to generate pwm for 10% duty cycle to 90% dutycycle .For every 10 seconds i am changing the period and compare value.
But no pwm output is coming i mean pwm getting stopped
please help me to generate duty cycle.
Thanks in adavance
PWM.cywrk.Archive01.zip 4.4 MB
in my code i removed the while(1); it's not working
I attached an snapshot of the pwm dutycycle.
According to your formula ,the duty_cycle should be 50% but it shows the waveform in the configuration as a 70% dutycycle waveform.
compare value=1,period=2ms ,ip frequency is 1000HZ .
please help me to resolve the issue.
Thanks in advance.
pwm_problem.png 311.9 K