Part Number:TMS320F28377S-Q1
EPWM配置为增计数模式并配置动作寄存器EPwm6Regs.AQCTLA.bit.ZRO = AQ_SET;EPwm6Regs.AQCTLA.bit.CAU = AQ_CLEAR;运行一段时间切换成减计数模式,并配置动作寄存器EPwm6Regs.AQCTLA.bit.ZRO = AQ_CLEAR;EPwm6Regs.AQCTLA.bit.CAD = AQ_SET;
遇到问题:切换临界点的那个开关周期,无法使计数模式立刻改变,再下一个周期就正常了。我想问一下为什么会这样?是否能够通过配置避免这个问题?
代码如下:
__interrupt void epwm6_isr(void)
{
++EPWMFLAG;
if(EPWMFLAG<50)
{
EPwm6Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;
EPwm6Regs.AQCTLA.bit.ZRO = AQ_SET;
EPwm6Regs.AQCTLA.bit.CAU = AQ_CLEAR;
}
else if(EPWMFLAG>=50&&EPWMFLAG<100)
{
EPwm6Regs.TBCTL.bit.CTRMODE = TB_COUNT_DOWN;
EPwm6Regs.AQCTLA.bit.ZRO = AQ_CLEAR;
EPwm6Regs.AQCTLA.bit.CAD = AQ_SET;
}
else
{
EPWMFLAG=0;
}
EPwm6Regs.ETCLR.bit.INT = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
}
Yale Li:
我们在你的原始问题中讨论即可:
https://e2echina.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/797897/tms320f28377s-q1-epwm