Skip to main content
Visitor II
July 14, 2023
Question

variable phase shift between two PWM signals

  • July 14, 2023
  • 2 replies
  • 1126 views

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  

This topic has been closed for replies.

2 replies

MasterT
Lead II
July 14, 2023

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

waclawek.jan
Super User
July 15, 2023

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