我的设计是使用F28021,系统时钟为40M,PWM模块的时钟与系统时钟一致,PWM计数方式为增减模式,要求输出的PWM波的频率为10K,这样我的PWM初始化程序如下:
EPwm1Regs.TBPRD = 2000; //load frq 10k and pwm frq 20k
EPwm1Regs.TBPHS.half.TBPHS = 0; //phase register to 0
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; //crease-decrease mode
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; //disable load the phase from the phase register
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //tbctr = 0;
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; //use shadow register
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; //use CTR = ZERO load
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;
EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;
EPwm1Regs.DBFED = 50;
EPwm1Regs.DBRED = 50;
EPwm4Regs.CMPA.half.CMPA = 750;
但是实际输出的PWM波的载波周期为20K,请问我的EPwm1Regs.TBPRD = 2000;是否有问题?