cancel
Showing results for 
Search instead for 
Did you mean: 

variable phase shift between two PWM signals

mosiTX
Associate

Hi,

I am trying to create to PWM outputs with a variable phase shift between them. They are of fixed frequency, 50% duty and exactly the same shape but with variable phase shift. I need to dynamically change the phase shift between them as a control parameter. I am OK with using two timers, but I cannot see how I can realize this.

Thanks  

2 REPLIES 2
MasterT
Lead

Simple trick is to use combined PWM mode. Take one timer, 4 channels would generate 2 PWM, where 1-st ch. defines start time and 2-nd channel - stop time of the first PWM, than 3 and 4 start/ stop second PWM.  To shift just change CCR3 & CCR4 as a pair

With 50% duty, an even simpler trick is to use two channels Output Compare in Toggle mode.  Simply changing CCRx of one of them will change their mutual phase.

JW