2020-03-26 03:24 PM
2020-03-26 03:24 PM
@Community member
2020-03-26 03: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
2020-03-26 03: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.
2020-03-26 03: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
2020-03-26 03: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?
2020-03-26 04:05 PM
Break is a safety feature, it does not change period but switches off the outputs.
JW