- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to change the duty cycle of an PWM frequenctly as per my requirement.
Can you tell me how to do it and also tell me the how to calculate the duty cycle based on input clk frequency
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bob for reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hI,
i want to generate a pwm dutycycle 20% to 90% but these below apis
PWM_WritePeriod(3);
PWM_WriteCompare(10);
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in my code i removed the while(1); it's not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks sir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
It is better to use the PWM block with higher counts(high period value) for higher accuracy. Other wise one clock cycle for toggle state can introduce this much error.