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

PWM_INIT_MACRO(1,2,3,pwm1) 这个语句是什么意思

// Initialize PWM module pwm1.PeriodMax = SYSTEM_FREQUENCY*1000000*T/2; // Prescaler X1 (T1), ISR period = T x 1
pwm1.HalfPerMax=pwm1.PeriodMax/2;
pwm1.Deadband = 2.0*SYSTEM_FREQUENCY; // 120 counts -> 2.0 usec for TBCLK = SYSCLK/1
PWM_INIT_MACRO(1,2,3,pwm1)

无传感器控制里的,请问最后一句什么意思

Susan Yang:

您可以看一下它的定义,主要是用于模块初始化

#define PWM_INIT_MACRO(ch1,ch2,ch3,v)\/* Setup Sync*/\(*ePWM[ch1]).TBCTL.bit.SYNCOSEL = 0;/* Pass through*/\(*ePWM[ch2]).TBCTL.bit.SYNCOSEL = 0;/* Pass through*/\(*ePWM[ch3]).TBCTL.bit.SYNCOSEL = 0;/* Pass through*/\\/* Allow each timer to be sync'ed*/\(*ePWM[ch1]).TBCTL.bit.PHSEN = 1;\(*ePWM[ch2]).TBCTL.bit.PHSEN = 1;\(*ePWM[ch3]).TBCTL.bit.PHSEN = 1;\\/* Init Timer-Base Period Register for EPWM1-EPWM3*/\(*ePWM[ch1]).TBPRD = v.PeriodMax;\(*ePWM[ch2]).TBPRD = v.PeriodMax;\(*ePWM[ch3]).TBPRD = v.PeriodMax;\\/* Init Timer-Base Phase Register for EPWM1-EPWM3*/\(*ePWM[ch1]).TBPHS.half.TBPHS = 0;\(*ePWM[ch2]).TBPHS.half.TBPHS = 0;\(*ePWM[ch3]).TBPHS.half.TBPHS = 0;\\/* Init Timer-Base Control Register for EPWM1-EPWM3*/\(*ePWM[ch1]).TBCTL.all = PWM_INIT_STATE;\(*ePWM[ch2]).TBCTL.all = PWM_INIT_STATE;\(*ePWM[ch3]).TBCTL.all = PWM_INIT_STATE;\\/* Init Compare Control Register for EPWM1-EPWM3*/\(*ePWM[ch1]).CMPCTL.all = CMPCTL_INIT_STATE;\(*ePWM[ch2]).CMPCTL.all = CMPCTL_INIT_STATE;\(*ePWM[ch3]).CMPCTL.all = CMPCTL_INIT_STATE;\\/* Init Action Qualifier Output A Register for EPWM1-EPWM3*/\(*ePWM[ch1]).AQCTLA.all = AQCTLA_INIT_STATE;\(*ePWM[ch2]).AQCTLA.all = AQCTLA_INIT_STATE;\(*ePWM[ch3]).AQCTLA.all = AQCTLA_INIT_STATE;\\/* Init Dead-Band Generator Control Register for EPWM1-EPWM3*/\(*ePWM[ch1]).DBCTL.all = DBCTL_INIT_STATE;\(*ePWM[ch2]).DBCTL.all = DBCTL_INIT_STATE;\(*ePWM[ch3]).DBCTL.all = DBCTL_INIT_STATE;\\/* Init Dead-Band Generator for EPWM1-EPWM3*/\(*ePWM[ch1]).DBFED = v.Deadband;\(*ePWM[ch1]).DBRED = v.Deadband;\(*ePWM[ch2]).DBFED = v.Deadband;\(*ePWM[ch2]).DBRED = v.Deadband;\(*ePWM[ch3]).DBFED = v.Deadband;\(*ePWM[ch3]).DBRED = v.Deadband;\\/* Init PWM Chopper Control Register for EPWM1-EPWM3*/\(*ePWM[ch1]).PCCTL.all = PCCTL_INIT_STATE;\(*ePWM[ch2]).PCCTL.all = PCCTL_INIT_STATE;\(*ePWM[ch3]).PCCTL.all = PCCTL_INIT_STATE;\\EALLOW;/* Enable EALLOW */\\/* Init Trip Zone Select Register*/\(*ePWM[ch1]).TZSEL.all = TZSEL_INIT_STATE;\(*ePWM[ch2]).TZSEL.all = TZSEL_INIT_STATE;\(*ePWM[ch3]).TZSEL.all = TZSEL_INIT_STATE;\\EDIS;/* Disable EALLOW*/

,

user5218438:

谢谢,请问这个是在哪个文件里找到的,请发一下路径or出处

,

Susan Yang:

您可以右键点击 PWM_INIT_MACRO,选择 open declaration 就可以找到了

赞(0)
未经允许不得转载:TI中文支持网 » PWM_INIT_MACRO(1,2,3,pwm1) 这个语句是什么意思
分享到: 更多 (0)