/*** Initialize ePWM1 modules ***/
{
EPWMPARAMS EPwm1Params;
/*-- Setup Time-Base (TB) Submodule --*/
EPwm1Params.TBPRD = 64000;
EPwm1Params.TBCTL_CTRMODE = 0;
EPwm1Params.TBCTL_SYNCOSEL = 3;
EPwm1Params.TBCTL_PHSEN = 0;
EPwm1Params.TBCTL_PHSDIR = 0;
EPwm1Params.TBPHS = 0;
EPwm1Params.TBCTL_HSPCLKDIV = 0;
EPwm1Params.TBCTL_CLKDIV = 0;
/*-- Setup Counter_Compare (CC) Submodule --*/
EPwm1Params.CMPCTL_LOADAMODE = 0;
EPwm1Params.CMPCTL_LOADBMODE = 0;
EPwm1Params.CMPA = 32000;
EPwm1Params.CMPB = 32000;
/*-- Setup Action-Qualifier (AQ) Submodule --*/
EPwm1Params.AQCTLA = 36;
EPwm1Params.AQCTLB = 264;
EPwm1Params.AQCSFRC_CSFA = 0;
EPwm1Params.AQCSFRC_CSFB = 0;
EPwm1Params.AQCSFRC_RLDCSF = 0;
/*-- Setup Dead-Band Generator (DB) Submodule --*/
EPwm1Params.DBCTL_OUT_MODE = 3;
EPwm1Params.DBCTL_IN_MODE = 0;
EPwm1Params.DBCTL_POLSEL = 1;
EPwm1Params.DBRED = 900.0;
EPwm1Params.DBFED = 900.0;
/*-- Setup Event-Trigger (ET) Submodule --*/
EPwm1Params.ETSEL_SOCAEN = 0;
EPwm1Params.ETSEL_SOCASEL = 1;
EPwm1Params.ETPS_SOCAPRD = 1;
EPwm1Params.ETSEL_SOCBEN = 0;
EPwm1Params.ETSEL_SOCBSEL = 1;
EPwm1Params.ETPS_SOCBPRD = 1;
EPwm1Params.ETSEL_INTEN = 0;
EPwm1Params.ETSEL_INTSEL = 1;
EPwm1Params.ETPS_INTPRD = 1;
/*-- Setup PWM-Chopper (PC) Submodule --*/
EPwm1Params.PCCTL_CHPEN = 0;
EPwm1Params.PCCTL_CHPFREQ = 0;
EPwm1Params.PCCTL_OSHTWTH = 0;
EPwm1Params.PCCTL_CHPDUTY = 0;
/*-- Setup Trip-Zone (TZ) Submodule --*/
EPwm1Params.TZSEL = 0;
EPwm1Params.TZCTL_TZA = 3;
EPwm1Params.TZCTL_TZB = 3;
EPwm1Params.TZEINT_OST = 0;
EPwm1Params.TZEINT_CBC = 0;
/*-- Initial ePWM1 --*/
config_ePWMRegs(&EPwm1Regs, &EPwm1Params);
}
主要设置如下:
/*-- Setup Dead-Band Generator (DB) Submodule --*/
EPwm1Params.DBCTL_OUT_MODE = 3;
EPwm1Params.DBCTL_IN_MODE = 0;
EPwm1Params.DBCTL_POLSEL = 1;
EPwm1Params.DBRED = 900.0;
EPwm1Params.DBFED = 900.0;
即:EPwm1Params.DBCTL_POLSEL = 1;
文章评论(0条评论)
登录后参与讨论