用dsp28035来产生spwm,三角波频率为30khz,正弦波频率为50hz,载波比为n=600;
时基的周期数值为1000,
比较器的值;
duty=500*sin(6.288*k/n)
部分程序如下:
EPwm2Regs.TBPRD = 1000;
EPwm2Regs.TBPHS.half.TBPHS = 0x0000;
EPwm2Regs.TBCTR = 0x0000;
EPwm2Regs.CMPA.half.CMPA =500;
EPwm2Regs.CMPB = 500;
EPwm2Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EPwm2Regs.AQCTLA.bit.CAD =AQ_SET;
EPwm2Regs.AQCTLB.bit.CAU = AQ_SET;
EPwm2Regs.AQCTLB.bit.CAD = AQ_CLEAR;
中断程序:
duty=500*(sin(6.283*k1/600))+500;
EPwm2Regs.CMPA.half.CMPA = duty;
EPwm2Regs.CMPB = duty;
k1++;
产生的spwm滤波后,馒头波频率为10hz,和理论值50hz,不一样,这是哪里出错了,求帮忙啊