I am trying to declare a variable in a module and reference it in my main () routine - should be straight forward but am getting the following link error:
Link Error : Multiply-defined: "LED_Status in Int_Handlers.c
Previously defined in main.c
I am using the variable LED_Status in the main routine and setting it in the interrupt routine for the PIT Timer.
unsigned char LED_Status = FALSE; // Declared just above main
int main()
{
int i;
char a;
mcf5222x_init(); // As well as all other initialization stuff
if (!LED_Status) etc etc etc....
.
.
.etc etc
}
This is in the Interrupt handling module.
extern unsigned char LED_Status = FALSE;
__interrupt__ void PIT0_handler (void);
__interrupt__ void PIT0_handler (void)
{
LED_Status = !LED_Status;
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF; // Reset by setting PIF
}
I tried declaring it in a .h file. Still the same problem.
Am I doing something stupidly obvious and stupidly wrong??
Many thanks
PS