Tool/software: Code Composer Studio
Goodmorning everybody!!
I have a question about the declaration and the use of arrays in Code Composer Studio.
In my code, what I want to do is something like this:
In my header file:
const unsigned int PROGRAMMA_1F[3]; #define SETPOINT_TEMP_VASCA_1F PROGRAMMA_1F[0] #define SETPOINT_TEMP_CUORE_1F PROGRAMMA_1F[1] #define TEMPO_LAVORO_1F PROGRAMMA_1F[2] SETPOINT_TEMP_VASCA_1F= 600; SETPOINT_TEMP_CUORE_1F= 580; TEMPO_LAVORO_1F= 300;
But, unfortunately the Code Composer shows me severals arrors like:
#145 a value of type "int" cannot be used to initialize an entity of type "int [0]"
#145 a value of type "int" cannot be used to initialize an entity of type "int [1]"
#145 a value of type "int" cannot be used to initialize an entity of type "int [2]"
#148 declaration is incompatible with "const unsigned int PROGRAMMA_1F[3]"
#148 declaration is incompatible with "int PROGRAMMA_1F[1]"
#150 variable "PROGRAMMA_1F" has already been initialized
I need to have SETPOINT_TEMP_VASCA_1F, SETPOINT_TEMP_CUORE_1F, TEMPO_LAVORO_1F fixed respectively with the values 600,580,300 because I have to use them in a C function like in this case:
In my C function:
if (BLANCH_CHECK != BLANCH_CHECK_F) {
switch (counter_prog) {
case 0: {
SETPOINT_TEMP_VASCA1=SETPOINT_TEMP_VASCA_1F;
SETPOINT_TEMP_CUORE1=SETPOINT_TEMP_CUORE_1F;
TEMPO_LAVORO1=TEMPO_LAVORO_1F;
} break;
case 2: {
SETPOINT_TEMP_VASCA2=SETPOINT_TEMP_VASCA_2F;
SETPOINT_TEMP_CUORE2=SETPOINT_TEMP_CUORE_2F;
TEMPO_LAVORO2=TEMPO_LAVORO_2F;
} break;
case 3: {
SETPOINT_TEMP_VASCA3=SETPOINT_TEMP_VASCA_3F;
SETPOINT_TEMP_CUORE3=SETPOINT_TEMP_CUORE_3F;
TEMPO_LAVORO3=TEMPO_LAVORO_3F;
} break;
}
}
What's wrong in my code? Is there another-better- way to do what I have to?
Waiting for your answers and advices (which I really appreciate),
Kind Regards
Maria Angela