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.

UCD3138CC64EVM-030: UCD3138CC64EVM-030

Part Number: UCD3138CC64EVM-030

我有一个关于开环的问题,我想用实验室程序2获得相同的输出信号PWM2和PWM0或死区时间,然后我尝试向寄存器提供相同的事件值,但实际输出不是同步。我如何实现这一点。这是我的配置代码:

void init_dpwm0(void)
{
Dpwm0Regs.DPWMCTRL0.bit.PWM_EN = 0; // disable DPWM0 locally during initilization

Dpwm0Regs.DPWMCTRL0.bit.CLA_EN = 0; // default is 1 (i.e. default is to use the filter output to control DPWM),

Dpwm0Regs.DPWMPRD.all = PERIOD; // use .all for all values, so that the scaling matches


Dpwm0Regs.DPWMEV1.all = EVENT1; // set EVENT 1 to 0% (start) of period 设置dpwma的上升沿
Dpwm0Regs.DPWMEV2.all = EVENT2; // 设置dpwma的下降沿
Dpwm0Regs.DPWMEV3.all = EVENT3; // 设置dpwmb的上升沿
Dpwm0Regs.DPWMEV4.all = EVENT4;

Dpwm0Regs.DPWMCTRL0.bit.PWM_EN = 1; //
LoopMuxRegs.GLBEN.bit.DPWM0_EN = 1; //

}

void init_dpwm2(void)
{
Dpwm2Regs.DPWMCTRL0.bit.PWM_EN = 0; // disable DPWM1 locally during initilization

Dpwm2Regs.DPWMCTRL0.bit.CLA_EN = 0; // default is 1 (i.e. default is to use the filter output to control DPWM),

Dpwm2Regs.DPWMPRD.all = PERIOD; // use .all for all values, so that the scaling matches


Dpwm2Regs.DPWMEV1.all = EVENT1; // set EVENT 1 to 0% (start) of period 设置dpwma的上升沿
Dpwm2Regs.DPWMEV2.all = EVENT2; // 设置dpwma的下降沿
Dpwm2Regs.DPWMEV3.all = EVENT3; // 设置dpwmb的上升沿
Dpwm2Regs.DPWMEV4.all = EVENT4;

Dpwm2Regs.DPWMCTRL0.bit.PWM_EN = 1; //
LoopMuxRegs.GLBEN.bit.DPWM2_EN = 1; // 

}