TI中文支持网
TI专业的中文技术问题搜集分享网站

APWMy与EPWM无法保持同相,有18°左右的相位差,麻烦请高手帮我看看。

我是要8路相位差为45度的pwm波,用EPWM模块可以发出6路,剩下的俩路只好用APWM,但我在使APWM模块的ECCTL2的SYNCI-EN置1了却一直存在18°左右的相位差,然后还调了半天都不行,以下是我的程序,麻烦高手帮我看看,谢谢。

ECap1Regs.TSCTR = 0x0;
ECap1Regs.ECCTL2.bit.APWMPOL = 0;
ECap1Regs.ECCTL2.bit.CAP_APWM = 1;
ECap1Regs.ECCTL2.bit.SYNCI_EN = 1;
ECap1Regs.ECCTL2.bit.SYNCO_SEL = 1;
ECap1Regs.ECCTL2.bit.TSCTRSTOP = 1;

ECap1Regs.CAP1 = 14999; //Set period value
ECap1Regs.CTRPHS = 0x0;

ECap1Regs.CAP2 = 1875; //Set Duty cycle

InitEPwm4Gpio();
InitEPwm5Gpio();
EPwm4Regs.TBSTS.all=0;
EPwm4Regs.TBPHS.half.TBPHS=0;
EPwm4Regs.TBCTR=0;

EPwm4Regs.CMPCTL.all=0x50; // Immediate mode for CMPA and CMPB
EPwm4Regs.CMPA.half.CMPA =SP/8;
EPwm4Regs.CMPB=SP/2;

EPwm4Regs.AQCTLA.all=0x60; // EPWMxA = 1 when CTR=CMPA and counter inc
// EPWMxA = 0 when CTR=CMPA and counter dec
EPwm4Regs.AQCTLB.all=0x60;
// EPwm1Regs.AQCTLB.all=0;
EPwm4Regs.AQSFRC.all=0;
EPwm4Regs.AQCSFRC.all=0;

EPwm4Regs.DBCTL.all=0x2b; // EPWMxB is inverted
EPwm4Regs.DBRED=0;
EPwm4Regs.DBFED=0;

EPwm4Regs.TZSEL.all=0;
EPwm4Regs.TZCTL.all=0;
EPwm4Regs.TZEINT.all=0;
EPwm4Regs.TZFLG.all=0;
EPwm4Regs.TZCLR.all=0;
EPwm4Regs.TZFRC.all=0;

EPwm4Regs.ETSEL.all=0; // Interrupt when TBCTR = 0x0000
EPwm4Regs.ETFLG.all=0;
EPwm4Regs.ETCLR.all=0;
EPwm4Regs.ETFRC.all=0;

EPwm4Regs.PCCTL.all=0;

EPwm4Regs.TBCTL.all=0x201a; // Enable Timer
EPwm4Regs.TBPRD=SP;

Brian Wang0:

论坛中有类似问题,您参考一下:

http://www.deyisupport.com/question_answer/microcontrollers/c2000/f/56/t/15085.aspx

赞(0)
未经允许不得转载:TI中文支持网 » APWMy与EPWM无法保持同相,有18°左右的相位差,麻烦请高手帮我看看。
分享到: 更多 (0)