How would I use the timer to generate a PWM signal - where, I can modify the width of one pulse? As an example, look at the illustration below; the red pulse is increased in width.
Any help would be appreciated.
Thanks
Craig.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-26 3:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-26 3:24 PM
@Community member​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-26 3:38 PM
Period is given by value of TIMx_ARR, while pulse length (duty) is given by TIMx_CCRy. Read the timer chapter in User Manual.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-26 3:42 PM
@Community member​ - Thanks for the answer. I am aware and know how to generate a PWM signal with a period T, and a given duty cycle. But, my question is here, how can I modify one pulse's width? The figure I gave above, the red pulse has its width modified, while the rest of the pulses are the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-26 3:50 PM
Your diagram suggests, that you want to change both the period and the duration of pulse (to maintain duty cycle).
Assuming you have both ARR and CCRx preload enabled by their respective bits (TIMx_CR1.ARPE/TIMx_CCMRx.OCyPE), you set the new value for ARR and CCRx during the period previous to the pulse to be changed, and then change back ARR and CCRx to the original value during the changed pulse.
You can do it conveniently in the Update interrupt.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-26 3:57 PM
@Community member​
Thanks for that. I figured that would be a option. However, I noted in the cookbook and manual that there is an ability to have a so-called break function. Could that work in this application/case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-26 4:05 PM
Break is a safety feature, it does not change period but switches off the outputs.
JW
