数字电源库在应用的时候,其中有个文件DAC_Cnf.c 文件涉及到了DACCTL变量,
extern volatile struct COMP_REGS *Comp[];
extern volatile struct EPWM_REGS *ePWM[];
void DacDrvCnf(int16 n, int16 DACval, int16 DACsrc, int16 RAMPsrc, int16 Slope_initial)
{
EALLOW;
(*Comp[n]).COMPCTL.bit.COMPDACEN = 1; // Power up Comparator locally
(*Comp[n]).COMPCTL.bit.COMPSOURCE = 0; // Connect the inverting input to internal DAC
(*Comp[n]).DACVAL.bit.DACVAL = (DACval>>5); // Set DAC output – Input is Q15 – Convert to Q10
(*Comp[n]).DACCTL.bit.DACSOURCE = DACsrc; // 0 – DACVAL; 1 – Internal ramp for slope compensation
if (DACsrc == 1) // Following lines of code are used when internal slope compensation is used {
(*Comp[n]).COMPCTL.bit.QUALSEL = 5; // Comparator output must be active for 4 consecutive clocks before resetting the RAMP
(*Comp[n]).DACCTL.bit.RAMPSOURCE = RAMPsrc; // 0 – PMW1; 1 – PWM2,…so on
(*Comp[n]).RAMPDECVAL_SHDW = Slope_initial;
(*ePWM[RAMPsrc+1]).HRPCTL.bit.PWMSYNCSEL = 1; // PWM SYNC generated at CTR = ZRO for synchronizing internal ramp
(*Comp[n]).COMPCTL.bit.CMPINV = 0; // Comparator Output passed
}
EDIS;
}
但是它在DSP2802x_Comp.h头文件中并没有该定义,
struct COM_REGS{
union COMPCTL_REG COMPCTL;
Unit16 rsvd1;
union COMPSTS_REG COMPSTS;
Unit16 rsvd2[3];
union DACVAL_REG DACVAL;
Unit16 rsvd4[10];运行程序ccs一直报错,no field,求解,谢谢
RUOF MA:
回复 Young Hu:
确实是这样,该程序库中有两个单独的文件Comp.h和pwm.h,单独定义了,感谢
数字电源库在应用的时候,其中有个文件DAC_Cnf.c 文件涉及到了DACCTL变量,
extern volatile struct COMP_REGS *Comp[];
extern volatile struct EPWM_REGS *ePWM[];
void DacDrvCnf(int16 n, int16 DACval, int16 DACsrc, int16 RAMPsrc, int16 Slope_initial)
{
EALLOW;
(*Comp[n]).COMPCTL.bit.COMPDACEN = 1; // Power up Comparator locally
(*Comp[n]).COMPCTL.bit.COMPSOURCE = 0; // Connect the inverting input to internal DAC
(*Comp[n]).DACVAL.bit.DACVAL = (DACval>>5); // Set DAC output – Input is Q15 – Convert to Q10
(*Comp[n]).DACCTL.bit.DACSOURCE = DACsrc; // 0 – DACVAL; 1 – Internal ramp for slope compensation
if (DACsrc == 1) // Following lines of code are used when internal slope compensation is used {
(*Comp[n]).COMPCTL.bit.QUALSEL = 5; // Comparator output must be active for 4 consecutive clocks before resetting the RAMP
(*Comp[n]).DACCTL.bit.RAMPSOURCE = RAMPsrc; // 0 – PMW1; 1 – PWM2,…so on
(*Comp[n]).RAMPDECVAL_SHDW = Slope_initial;
(*ePWM[RAMPsrc+1]).HRPCTL.bit.PWMSYNCSEL = 1; // PWM SYNC generated at CTR = ZRO for synchronizing internal ramp
(*Comp[n]).COMPCTL.bit.CMPINV = 0; // Comparator Output passed
}
EDIS;
}
但是它在DSP2802x_Comp.h头文件中并没有该定义,
struct COM_REGS{
union COMPCTL_REG COMPCTL;
Unit16 rsvd1;
union COMPSTS_REG COMPSTS;
Unit16 rsvd2[3];
union DACVAL_REG DACVAL;
Unit16 rsvd4[10];运行程序ccs一直报错,no field,求解,谢谢
user78960159:
回复 RUOF MA:
请问是如何解决编译错误的呢?
我用的是V129版本的库文件
数字电源库在应用的时候,其中有个文件DAC_Cnf.c 文件涉及到了DACCTL变量,
extern volatile struct COMP_REGS *Comp[];
extern volatile struct EPWM_REGS *ePWM[];
void DacDrvCnf(int16 n, int16 DACval, int16 DACsrc, int16 RAMPsrc, int16 Slope_initial)
{
EALLOW;
(*Comp[n]).COMPCTL.bit.COMPDACEN = 1; // Power up Comparator locally
(*Comp[n]).COMPCTL.bit.COMPSOURCE = 0; // Connect the inverting input to internal DAC
(*Comp[n]).DACVAL.bit.DACVAL = (DACval>>5); // Set DAC output – Input is Q15 – Convert to Q10
(*Comp[n]).DACCTL.bit.DACSOURCE = DACsrc; // 0 – DACVAL; 1 – Internal ramp for slope compensation
if (DACsrc == 1) // Following lines of code are used when internal slope compensation is used {
(*Comp[n]).COMPCTL.bit.QUALSEL = 5; // Comparator output must be active for 4 consecutive clocks before resetting the RAMP
(*Comp[n]).DACCTL.bit.RAMPSOURCE = RAMPsrc; // 0 – PMW1; 1 – PWM2,…so on
(*Comp[n]).RAMPDECVAL_SHDW = Slope_initial;
(*ePWM[RAMPsrc+1]).HRPCTL.bit.PWMSYNCSEL = 1; // PWM SYNC generated at CTR = ZRO for synchronizing internal ramp
(*Comp[n]).COMPCTL.bit.CMPINV = 0; // Comparator Output passed
}
EDIS;
}
但是它在DSP2802x_Comp.h头文件中并没有该定义,
struct COM_REGS{
union COMPCTL_REG COMPCTL;
Unit16 rsvd1;
union COMPSTS_REG COMPSTS;
Unit16 rsvd2[3];
union DACVAL_REG DACVAL;
Unit16 rsvd4[10];运行程序ccs一直报错,no field,求解,谢谢
user78960159:
回复 user78960159:
问题解决了
用controlSUITE里的DSP2802x_Comp.h和DSP2802x_EPwm.h覆盖V129版本下的相同文件
且要注意app_libs的版本要用3.2的,不要用最新的3.5
否则会报下面的错误:
因为两个版本的库文件不一样
数字电源库在应用的时候,其中有个文件DAC_Cnf.c 文件涉及到了DACCTL变量,
extern volatile struct COMP_REGS *Comp[];
extern volatile struct EPWM_REGS *ePWM[];
void DacDrvCnf(int16 n, int16 DACval, int16 DACsrc, int16 RAMPsrc, int16 Slope_initial)
{
EALLOW;
(*Comp[n]).COMPCTL.bit.COMPDACEN = 1; // Power up Comparator locally
(*Comp[n]).COMPCTL.bit.COMPSOURCE = 0; // Connect the inverting input to internal DAC
(*Comp[n]).DACVAL.bit.DACVAL = (DACval>>5); // Set DAC output – Input is Q15 – Convert to Q10
(*Comp[n]).DACCTL.bit.DACSOURCE = DACsrc; // 0 – DACVAL; 1 – Internal ramp for slope compensation
if (DACsrc == 1) // Following lines of code are used when internal slope compensation is used {
(*Comp[n]).COMPCTL.bit.QUALSEL = 5; // Comparator output must be active for 4 consecutive clocks before resetting the RAMP
(*Comp[n]).DACCTL.bit.RAMPSOURCE = RAMPsrc; // 0 – PMW1; 1 – PWM2,…so on
(*Comp[n]).RAMPDECVAL_SHDW = Slope_initial;
(*ePWM[RAMPsrc+1]).HRPCTL.bit.PWMSYNCSEL = 1; // PWM SYNC generated at CTR = ZRO for synchronizing internal ramp
(*Comp[n]).COMPCTL.bit.CMPINV = 0; // Comparator Output passed
}
EDIS;
}
但是它在DSP2802x_Comp.h头文件中并没有该定义,
struct COM_REGS{
union COMPCTL_REG COMPCTL;
Unit16 rsvd1;
union COMPSTS_REG COMPSTS;
Unit16 rsvd2[3];
union DACVAL_REG DACVAL;
Unit16 rsvd4[10];运行程序ccs一直报错,no field,求解,谢谢
user1333144:
回复 user78960159:
使用V130就好了