程序如下面所述,周期寄存器的值是7500,打算让PWM2滞后PWM1四分之一个周期,之前给的图像是PWM1A和PWM2A的波形,发现,PWM2A实际上超前PWM1A四分之一个周期。请问是哪里出现了问题?怎么改正?
EPwm1Regs.TBPHS.half.TBPHS = 0x0000;
EPwm2Regs.TBPHS.half.TBPHS = 1875;
EPwm1Regs.TBCTR = 0x0000;
EPwm2Regs.TBCTR = 0x0000;
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;
EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;
EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE;
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;
EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;
EPwm1Regs.AQCTLA.bit.CBU = AQ_CLEAR;
EPwm2Regs.AQCTLA.bit.CAU = AQ_SET;
EPwm2Regs.AQCTLA.bit.CBU = AQ_CLEAR;
|