This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

对TI公司的无刷直流电机头文件f2803xbldcpwm.h的理解

Other Parts Discussed in Thread: CONTROLSUITE

这一段时间看了TI公司的DSP28035无刷直流电机的PWM驱动模块儿头文件中内容,有一段不是很理解,不知道这是用来干什么的,内容如下:

 int32 Tmp;
 int16 Period, GPR0_BLDC_PWM;

#define BLDCPWM_MACRO(ch1,ch2,ch3,v)    /*     
/* Convert "Period" (Q15) modulation function to Q0       
   Tmp = (int32)v.PeriodMax*(int32)v.MfuncPeriod;  /* Q15 = Q0xQ15    
   Period = (int16)(Tmp>>15);                      /* Q15 -> Q0 (Period)     
             /*    
/* Check PwmActive setting            
 if (v.PwmActive==1)                      /* PWM active high    
     GPR0_BLDC_PWM = 0x7FFF - v.DutyFunc;   /*         
                 /*     
   else if (v.PwmActive==0)                 /* PWM active low     
     GPR0_BLDC_PWM = v.DutyFunc;     /*      
             /*    
/* Convert "DutyFunc" or "GPR0_BLDC_PWM" (Q15) duty modulation function to Q0 
   Tmp = (int32)Period*(int32)GPR0_BLDC_PWM;      /* Q15 = Q0xQ15   
             /*   

我不知道这段代码的具体是什么功能,望赐教!

  • guo,

    这段代码是计算比较寄存器的值啊。

    周期值 * 占空比,然后根据PWM是高电平有效还是低电平有效,计算出比较寄存器的值。

    这些驱动库都有说明文档在controlSUITE中。

    Eric