Hello,
I'm trying to generate a PWM signal with C2000 LaunchPad but I cannot do this.
How can I generate a PWM signal by using C2000 LaunchPad?
Could you help me?
Thank you so much.
Metin
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I'm trying to generate a PWM signal with C2000 LaunchPad but I cannot do this.
How can I generate a PWM signal by using C2000 LaunchPad?
Could you help me?
Thank you so much.
Metin
Thank you for your responding.
I looked that example but how can I change the duty cycle in this example?
Thanks again.
Regards.
Metin.
Hi Devin.
Actually I have following code and I have just generate PWM but my new problem is changing the duty cycle of PWM.
I want to change the duty cycle.
Could you help me about this?
Thank you so much.
Regards.
Metin.
Metin,
The duty cycle for this example is set in these lines:
// Setup compare
PWM_setCmpA(myPwm1, 1000 );
This sets the PWM to generate a CMPA event when the counter matches 1000. Changing this value should change the duty cycle.
Trey
Hi Trey,
I have tried it many times but it does not affect anything.
Duty ratio does not change with this method.
Metin,
The compare value is in fact what sets the duty cycle.
I just double checked and if you run the EPwm Up Down AQ example as Devin suggested, you will in fact see the duty cycle change from 0% to 100% and then back repeatedly.
Which example are you running and what is the version number of the F2802x device support folder you are using?
Trey
Trey,
I have just modified my code and it work such as you said. I mean, CMPA value changes the duty ratio.
Thank you so much. But as a last question, I use equations for output PWM signal frequency and the duty ratio. These are:
Output PWM frequency = f(cpu)/[T(timer)*ClkDiv*HspClcDiv]
Duty ratio(%) = (CMPA*100)/(T(timer)+1)
T(timer) is also called TMPRD.
With these equation, I obtain frequency and duty ratio what I want to get. I tried it many times and these equations are working correctly.
What do you think about these equations?
Are they correct?
Thank you.
Metin
These equations seems correct. Are they not yielding the correct values? If not, by what factor are they off? Is the duty cycle correct, but the frequency is off? Please give more information.
Trey
Trey,
They are yielding correct values. I have no problem with the results of these equations but I just wonder is there any problem with them.
Actually, there was a frequency equation in TIs controlstick labs pdf. but it did not work in my code and I modified it as I said before. And now I have a doubt about their reliability although I get true results.
I want to colsult with you about their reliability.
Thank you so much.
Metin
Hi Trey,
I want to ask a question to you.
I want to obtain complemantary PWMs on PWM1A and PWM1B with deadband.
If I use deadband codes, PWM1A and PWM1B are not working as a complemantary but deadband works.
I want bot complementary operation and deadband.
How can I do?
Edit: Trey I have just done it.
Thank you.
Metin Ozturk