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.

60 % Duty Cycle

Hello everyone. I want tvo generate a PWM with 60% duty cycle. the frequency is 1KHz. Please see my codes and let me know which part I have to change to make the duty cycle 60% NOT 50%

void InitEPwm_ch1()
{
// this PWM is responsible for first wave form in the figure f = 1k
EPwm1Regs.TBPRD = 4; // Set timer period
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.TBCTR = 0x0000; // Clear counter

// Setup TBCLK

EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up-down to form 50% duty cycle
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV4; // Clock ratio to SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV4;


// Set actions
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on Zero
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;


EPwm1Regs.AQCTLB.bit.CAU = AQ_NO_ACTION; // Set PWM1A on Zero
EPwm1Regs.AQCTLB.bit.CAD = AQ_NO_ACTION;


}