#include "smopos.h" // Include header for the SMOPOS object#include "smopos_const.h" // Include header for the SMOPOS object
#include "park.h" // Include header for the PARK object#include "ipark.h" // Include header for the IPARK object#include "pid_reg3.h" // Include header for the PIDREG3 object#include "clarke.h" // Include header for the CLARKE object#include "svgen_dq.h" // Include header for the SVGENDQ object#include "rampgen.h" // Include header for the RAMPGEN object#include "rmp_cntl.h" // Include header for the RMPCNTL object#include "volt_calc.h" // Include header for the PHASEVOLTAGE object#include "speed_est.h" // Include header for the SPEED_ESTIMATION object#include "speed_fr.h" // Include header for the SPEED_MEAS_QEP object
#if (DSP2803x_DEVICE_H==1)
#include "f2803xileg_vdc.h" // Include header for the ILEG2DCBUSMEAS object#include "f2803xpwm.h" // Include header for the PWMGEN object
#include "f2803xpwmdac.h" // Include header for the PWMGEN object
#include "f2803xqep.h" // Include header for the QEP object
#include "DSP2803x_EPwm_defines.h" // Include header for PWM defines
#endif
"HVPM_Sensorless.h" 里面包含了很多马达控制宏定义的函数,当我其他.C函数调用"HVPM_Sensorless.h" 时,会出现宏函数里的局部变量会重复定义。
"HVPM_Sensorless.h" 已经在main.c中调用,请问怎么解决,谢谢
错误信息见图
peter shi:
除了把局部变量定义成全局变量,在头文件中extern外,还有什么办法?
#include "smopos.h" // Include header for the SMOPOS object#include "smopos_const.h" // Include header for the SMOPOS object
#include "park.h" // Include header for the PARK object#include "ipark.h" // Include header for the IPARK object#include "pid_reg3.h" // Include header for the PIDREG3 object#include "clarke.h" // Include header for the CLARKE object#include "svgen_dq.h" // Include header for the SVGENDQ object#include "rampgen.h" // Include header for the RAMPGEN object#include "rmp_cntl.h" // Include header for the RMPCNTL object#include "volt_calc.h" // Include header for the PHASEVOLTAGE object#include "speed_est.h" // Include header for the SPEED_ESTIMATION object#include "speed_fr.h" // Include header for the SPEED_MEAS_QEP object
#if (DSP2803x_DEVICE_H==1)
#include "f2803xileg_vdc.h" // Include header for the ILEG2DCBUSMEAS object#include "f2803xpwm.h" // Include header for the PWMGEN object
#include "f2803xpwmdac.h" // Include header for the PWMGEN object
#include "f2803xqep.h" // Include header for the QEP object
#include "DSP2803x_EPwm_defines.h" // Include header for PWM defines
#endif
"HVPM_Sensorless.h" 里面包含了很多马达控制宏定义的函数,当我其他.C函数调用"HVPM_Sensorless.h" 时,会出现宏函数里的局部变量会重复定义。
"HVPM_Sensorless.h" 已经在main.c中调用,请问怎么解决,谢谢
错误信息见图
Johnson Chen1:
回复 peter shi:
楼主,
你好!
没有问题的。我的项目里就是这样做的,我有一个user_Def.c 和user_Def.h文件,user.h里面有调用"HVPM_Sensorless.h" ,user_Def.c 中有对 rc1等结构体进行操作,编译没有问题。只是要把其它的结构体变量声明为extern,估计楼主是否在其他文件里面包含了PeripheralHeaderIncludes.h文件?
例如:
extern RMPCNTL rc1;
extern RAMPGEN rg1;
extern SMOPOS smo1;
extern SPEED_ESTIMATION speed3;
extern PARK park1 ;
extern IPARK ipark1 ;
#include "smopos.h" // Include header for the SMOPOS object#include "smopos_const.h" // Include header for the SMOPOS object
#include "park.h" // Include header for the PARK object#include "ipark.h" // Include header for the IPARK object#include "pid_reg3.h" // Include header for the PIDREG3 object#include "clarke.h" // Include header for the CLARKE object#include "svgen_dq.h" // Include header for the SVGENDQ object#include "rampgen.h" // Include header for the RAMPGEN object#include "rmp_cntl.h" // Include header for the RMPCNTL object#include "volt_calc.h" // Include header for the PHASEVOLTAGE object#include "speed_est.h" // Include header for the SPEED_ESTIMATION object#include "speed_fr.h" // Include header for the SPEED_MEAS_QEP object
#if (DSP2803x_DEVICE_H==1)
#include "f2803xileg_vdc.h" // Include header for the ILEG2DCBUSMEAS object#include "f2803xpwm.h" // Include header for the PWMGEN object
#include "f2803xpwmdac.h" // Include header for the PWMGEN object
#include "f2803xqep.h" // Include header for the QEP object
#include "DSP2803x_EPwm_defines.h" // Include header for PWM defines
#endif
"HVPM_Sensorless.h" 里面包含了很多马达控制宏定义的函数,当我其他.C函数调用"HVPM_Sensorless.h" 时,会出现宏函数里的局部变量会重复定义。
"HVPM_Sensorless.h" 已经在main.c中调用,请问怎么解决,谢谢
错误信息见图
peter shi:
回复 Johnson Chen1:
你的"HVPM_Sensorless.h"除了在user.h里定义外,还在别的地方include了吗?
#include "smopos.h" // Include header for the SMOPOS object#include "smopos_const.h" // Include header for the SMOPOS object
#include "park.h" // Include header for the PARK object#include "ipark.h" // Include header for the IPARK object#include "pid_reg3.h" // Include header for the PIDREG3 object#include "clarke.h" // Include header for the CLARKE object#include "svgen_dq.h" // Include header for the SVGENDQ object#include "rampgen.h" // Include header for the RAMPGEN object#include "rmp_cntl.h" // Include header for the RMPCNTL object#include "volt_calc.h" // Include header for the PHASEVOLTAGE object#include "speed_est.h" // Include header for the SPEED_ESTIMATION object#include "speed_fr.h" // Include header for the SPEED_MEAS_QEP object
#if (DSP2803x_DEVICE_H==1)
#include "f2803xileg_vdc.h" // Include header for the ILEG2DCBUSMEAS object#include "f2803xpwm.h" // Include header for the PWMGEN object
#include "f2803xpwmdac.h" // Include header for the PWMGEN object
#include "f2803xqep.h" // Include header for the QEP object
#include "DSP2803x_EPwm_defines.h" // Include header for PWM defines
#endif
"HVPM_Sensorless.h" 里面包含了很多马达控制宏定义的函数,当我其他.C函数调用"HVPM_Sensorless.h" 时,会出现宏函数里的局部变量会重复定义。
"HVPM_Sensorless.h" 已经在main.c中调用,请问怎么解决,谢谢
错误信息见图
peter shi:
回复 peter shi:
你的"HVPM_Sensorless.h"除了在user.h里定义外,还在别的地方include了吗?比如在main.c中,也include了"HVPM_Sensorless.h"吗?
#include "smopos.h" // Include header for the SMOPOS object#include "smopos_const.h" // Include header for the SMOPOS object
#include "park.h" // Include header for the PARK object#include "ipark.h" // Include header for the IPARK object#include "pid_reg3.h" // Include header for the PIDREG3 object#include "clarke.h" // Include header for the CLARKE object#include "svgen_dq.h" // Include header for the SVGENDQ object#include "rampgen.h" // Include header for the RAMPGEN object#include "rmp_cntl.h" // Include header for the RMPCNTL object#include "volt_calc.h" // Include header for the PHASEVOLTAGE object#include "speed_est.h" // Include header for the SPEED_ESTIMATION object#include "speed_fr.h" // Include header for the SPEED_MEAS_QEP object
#if (DSP2803x_DEVICE_H==1)
#include "f2803xileg_vdc.h" // Include header for the ILEG2DCBUSMEAS object#include "f2803xpwm.h" // Include header for the PWMGEN object
#include "f2803xpwmdac.h" // Include header for the PWMGEN object
#include "f2803xqep.h" // Include header for the QEP object
#include "DSP2803x_EPwm_defines.h" // Include header for PWM defines
#endif
"HVPM_Sensorless.h" 里面包含了很多马达控制宏定义的函数,当我其他.C函数调用"HVPM_Sensorless.h" 时,会出现宏函数里的局部变量会重复定义。
"HVPM_Sensorless.h" 已经在main.c中调用,请问怎么解决,谢谢
错误信息见图
Johnson Chen1:
回复 peter shi:
是的 ,main.c 里面也包含。如果你的项目过不了,可以贴上来我帮你看一下。
TI中文支持网



