在HVBLDC_Sensored例程中在主函数有如下变量
现在我想将这几个变量声明为全局变量,即:
extern PWMGEN pwm1;
extern PWMDAC pwmdac1;
extern HALL3 hall1;
将它们也用于其他的.C文件,发现报错,
如提示所示,有重复定义,可我并没有发现重复定义,请问是怎么回事?
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.
在HVBLDC_Sensored例程中在主函数有如下变量
现在我想将这几个变量声明为全局变量,即:
extern PWMGEN pwm1;
extern PWMDAC pwmdac1;
extern HALL3 hall1;
将它们也用于其他的.C文件,发现报错,
如提示所示,有重复定义,可我并没有发现重复定义,请问是怎么回事?
shizhong,
可以把PWMGEN等的typedefine copy到这个c文件的开头,如
typedef struct { Uint16 CmtnPointer; // Input: Commutation (or switching) state pointer input (Q0) int16 MfuncPeriod; // Input: Duty ratio of the PWM outputs (Q15) Uint16 PeriodMax; // Parameter: Maximum period (Q0) int16 DutyFunc; // Input: PWM period modulation input (Q15) Uint16 PwmActive; // Parameter: 0 = PWM active low, 1 = PWM active high (0 or 1)
} PWMGEN;
extern PWMGEN pwm1;
Eric