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.

2803x 移相 pwm的第二路的PWM的计数器值大于周期值?



在中断中只更新周期值时,增计数模式,pwm2计数器,为何计数到周期值时不清零?而是继续向上计数。我仿真时,pwm2计数器大部分是竟然大于周期值。pwm2的计数器从移相值开始计数,计数到周期值+移相值后,掉到移相值,然后再从移相值计数到周期值+移相值,循环。不知道为何会出现这样的情况。
异常情况2:在中断中,对TBPRD重新再次赋值一次,pwm1能够正常发板,pwm2不能发波,pwm3正常发波,移相240

interrupt void epwm1_isr(void)
{

EPwm1Regs.TBPRD = 299; 
EPwm2Regs.TBPRD = 299; 
EPwm3Regs.TBPRD = 299; 

EPwm2Regs.TBPHS.half.TBPHS = 299-100;
 EPwm3Regs.TBPHS.half.TBPHS = 299-200;


EPwm1TimerIntCount++;


EPwm1Regs.ETCLR.bit.INT = 1;

// Acknowledge this interrupt to receive more interrupts from group 3
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;

}