|
EPwm1Regs.TBPRD = 2500; //period register
EPwm1Regs.TBPHS.half.TBPHS=0; // Set Phase register to zero
EPwm1Regs.TBCTL.bit.CTRMODE = 2; // Up-Down mode // Symmetrical mode
EPwm1Regs.TBCTL.bit.PHSEN = 0; // Master module
EPwm1Regs.TBCTL.bit.PRDLD = 0;
EPwm1Regs.TBCTL.bit.SYNCOSEL = 1; // Sync down-stream module
EPwm1Regs.TBCTL.bit.HSPCLKDIV =1;//1; //TBCLK=50M
EPwm1Regs.TBCTL.bit.CLKDIV = 0;
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = 0;
EPwm1Regs.CMPCTL.bit.LOADAMODE = 0; //1// load on CTR=Zero
EPwm1Regs.CMPCTL.bit.LOADBMODE = 0; //1// load on CTR=Zero
EPwm1Regs.AQCTLA.bit.CAU = 2; // set actions for EPWM1A
EPwm1Regs.AQCTLA.bit.CAD = 1; // active high
EPwm1Regs.AQCTLB.bit.CAU = 1; // set actions for EPWM1B
EPwm1Regs.AQCTLB.bit.CAD = 2; //active low
EPwm1Regs.DBFED =200; // 4us
EPwm1Regs.DBRED =200; // 4us
//EPwm1Regs.DBCTL.bit.POLSEL = 1; // Active Lo complementary
EPwm1Regs.DBCTL.bit.POLSEL = 2; // Active Hi complementary
EPwm1Regs.DBCTL.bit.OUT_MODE = 3; // enable Dead-band module
像这样依次配置6路PWM,用示波器检测的时候发现,每一路的波形之间有一个相位差,也就意味着这6个定时器不是同步启动的,请问有什么方法可以让6个定时器同步启动吗?以获得6路同步的波形。
6路是指PWM1A PWM2A...PWM6A,而且给的占空比都是相同的。
|
|