0
\$\begingroup\$

I want to generate 2 PWM on PC6 & PC7 on an STM32f10x , it work fine but , the problem that I have is that I want to make them phase shifted to each other , say 45° and I really don't how to do that, since the PWM started at the same time. any idea how tihis could be made.

thanks for any hint

\$\endgroup\$
  • \$\begingroup\$ A complex waveform like PWM has many frequencies and therefore many phase relationships. 45 degrees is meaningless - I think you want a fixed time displacement. \$\endgroup\$ – Andy aka Jul 10 '15 at 8:19
  • 1
    \$\begingroup\$ @Andyaka NO the fequency it'S about to signals with the same frequency that are phase shifted to eached other \$\endgroup\$ – Engine Jul 10 '15 at 8:26
  • 1
    \$\begingroup\$ I am not familiar with that STM32, but PWM engines that have that possibility are generally advertised as such. Instead of one match register per channel they have two (plus one to reset the counter). \$\endgroup\$ – Wouter van Ooijen Jul 10 '15 at 8:35
  • 1
    \$\begingroup\$ @Andyaka: Your initial comment makes no sense. Even a complex waveform has a fundamental frequency, and it's perfectly reasonable to talk about delaying it by 45 degrees, or 1/8 of its period. \$\endgroup\$ – Dave Tweed Jul 10 '15 at 11:13
  • 1
    \$\begingroup\$ @Andyaka: Why would that be madness? That's the way it's done all the time! Remember, we're talking about driving a motor here, so the "phase angle" we're talking about relates to the rotation of the motor shaft. \$\endgroup\$ – Dave Tweed Jul 10 '15 at 13:53
2
\$\begingroup\$

If you want to do that inside your code, try taking a look at this solution. Alternatively, you could use a special IC for this task. Here is the example

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.