|
|
View previous topic :: View next topic |
Author |
Message |
cobra_coder
Joined: 04 Feb 2011 Posts: 2
|
Pointers and arrays of enum |
Posted: Fri Feb 04, 2011 6:33 pm |
|
|
The code below compiled and executed fine with CCS compiler ver. 4.069 but doesn't compile and gives following error messages for compiler ver. 4.099. Please let me know what's going on. I seem to use correct syntax. I haven't changed anything to my code between the compilers.
First few error messages are for default_dac_order *Received_DAC_order[15] and the error messages are:
*** Error 22 "kt-s_test.c" Line 91(41,42): Bad expression syntax
*** Error 43 "kt-s_test.c" Line 91(48,49): Expecting a declaration
*** Error 48 "kt-s_test.c" Line 91(49,55): Expecting a (
Next few error messages are for const int8 DAC_val_count[] and the error messages are:
*** Error 12 "lv922kt-s_etest.c" Line 93(40,46): Undefined identifier OPTdac
*** Error 43 "lv922kt-s_etest.c" Line 93(48,49): Expecting a declaration
*** Error 43 "lv922kt-s_etest.c" Line 93(49,55): Expecting a declaration
Although it says OPTdac is undefined, I have defined it.
Code: |
#include <18F4523.h>
/* some other declarations*/
enum default_dac_order {VBUFH,VDD,VSS,VCC,OPTREF1,VIMPLOW,VIMPUP,VHRVHL,VIDHREF,VIDLREF,OPTREF2,VIDHSUP,VCAPIN,OPTSUP2,OPTSUP1,VIDLSUP};
default_dac_order OPTdac[]={OPTREF1,VIDHREF,VIDLREF,OPTREF2,VIDHSUP,OPTSUP2,OPTSUP1,VIDLSUP}; //OPT DAC order
default_dac_order AITdac[]={VDD,VSS,VIMPLOW,VIMPUP}; //AIT DAC order
default_dac_order STGdac[]={VDD,VSS}; //STG DAC order
default_dac_order STSdac[]={VDD,VSS}; //STS DAC order
default_dac_order DRXdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //DRX DAC order
default_dac_order DCRdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //DCR DAC order
default_dac_order DCLdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //DCL DAC order
default_dac_order DCFdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //DCF DAC order
default_dac_order PDRdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //PDR DAC order
default_dac_order SLPdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //SLP DAC order
default_dac_order CAPdac[]={VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //CAP DAC order
default_dac_order VCHdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //VCH DAC order
default_dac_order ROWdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //ROW DAC order
default_dac_order PTTdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //PTT DAC order
default_dac_order INXdac[]={VBUFH,VDD,VSS,VIDHREF,VIDLREF,VIDHSUP,VIDLSUP}; //INX DAC order
default_dac_order *Received_DAC_order[15]={OPTdac,AITdac,STGdac,STSdac,DRXdac,DCRdac,DCLdac,DCFdac,PDRdac,SLPdac,CAPdac,VCHdac,ROWdac,PTTdac,INXdac};
const int8 DAC_val_count[]={sizeof(OPTdac)/sizeof(default_dac_order),sizeof(AITdac)/sizeof(default_dac_order),sizeof(STGdac)/sizeof(default_dac_order),
sizeof(STSdac)/sizeof(default_dac_order),sizeof(DRXdac)/sizeof(default_dac_order),sizeof(DCRdac)/sizeof(default_dac_order),
sizeof(DCLdac)/sizeof(default_dac_order),sizeof(DCFdac)/sizeof(default_dac_order),sizeof(PDRdac)/sizeof(default_dac_order),
sizeof(SLPdac)/sizeof(default_dac_order),sizeof(CAPdac)/sizeof(default_dac_order),sizeof(VCHdac)/sizeof(default_dac_order),
sizeof(ROWdac)/sizeof(default_dac_order),sizeof(PTTdac)/sizeof(default_dac_order),sizeof(INXdac)/sizeof(default_dac_order),
};
/*some other code*/
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 04, 2011 10:19 pm |
|
|
As a work-around, try declaring the array as 'int16' as shown below.
Just make that one change. See if it works:
Quote: |
int16 Received_DAC_order[15]={OPTdac,AITdac,STGdac,STSdac,DRXdac,DCRdac,DCLdac,DCFdac,PDRdac,SLPdac,CAPdac,VCHdac,ROWdac,PTTdac,INXdac}; |
|
|
|
cobra_coder
Joined: 04 Feb 2011 Posts: 2
|
Pointers and arrays of enum |
Posted: Mon Feb 07, 2011 10:43 am |
|
|
Thanks. That worked. I wonder why the original code doesn't compile on ver. 4.099. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|