Part Number: MSP430FR2422
I am calling a function in main that exists in a second file. The function call in main is:
configRTC(1800);
The function definition in funct.c is:
void configRTC(unsigned int s)
{
unsigned int k, div = 0;
if (s < 2)
div = divB[0];
else if (s >= 2048)
div = divA[3];
else {
for (k = 0; k < 3; k++) {
if (s > (2 * divA[k]))
div = (k + 1);
}
}
RTCMOD = (int)((float)(32768 / divA[div]) * s) - 1;
RTCCTL = RTCSS__XT1CLK | RTCSR | (div + 4) << 8;
RTCCTL &= ~RTCIFG;
RTCCTL |= RTCIE;
}
In funct.h I define divA and divB:
unsigned int divA[4] = {16, 64, 256, 1024};
unsigned int divB[4] = {1, 10, 100, 1000};
When I go to build main I get the following errors:
#10056 symbol "divA" redefined: first defined in "./funct.obj"; redefined in "./main.obj" #10056 symbol "divB" redefined: first defined in "./funct.obj"; redefined in "./main.obj"
I don't understand why main is trying to redefine these as they are local to the function only and don't exist in main. I have tried placing extern in main but to no avail? funct.h is included in both main and in funct.c. I can build funct.c without errors so I know my problem is with main somewhere??
Thanks