Go Down

Topic: Complementary PWM on the Due (Read 702 times) previous topic - next topic

jonnygainz

Good day,

I've tried the code given on this forum post to generate complementary PWM signals:


https://forum.arduino.cc/index.php?topic=527573.0

But when I change the period and duty cycle the circuit behaves unexpectedly. When I have the duty cycle set to 100% the PWML2 pin outputs a high abd when I have the duty cycle at 0% the PWMH2 pin outputs a high. Also for even number duty cycles such as 100%, 80%, 60%..... the PWML2 outluts high while for 90, 70, 50...... The two pins output values. can someone clarify got me how this code is supposed to work?

ard_newbie


fgl27

#2
Dec 31, 2018, 01:36 am Last Edit: Jan 01, 2019, 06:51 pm by fgl27
In some PWM the PWM_CDTY is the off time the H and L shows you that, H duty equals off time, L duty equal on time.

I tested the PWMH2, if you put a LED over it as high the duty goes the LED gets darker.

I also tested the PWML6 and PWML7 and the behavior is the expected as high is the duty goes more bright the led gets.

Here https://forum.arduino.cc/index.php?topic=453208.0 post #4 how to enable 8 PWM channels for testing

jonnygainz


Go Up