Quote:
|
Originally Posted by BillyJ
I have a stupid question about my code that just wont work..........
In all my code I've always setup the variables I need in user_routines_fast.c for auto, and user_routines.c for the main.
Now I want to use the same variable in both files, how could I go about doing this?
Thanks
|
Declare your variable as usual in whichever .c file, and then add an extern in the other .c file where you want to access the variable. Example:
Code:
user_SerialDrv.c:55: unsigned char aBreakerWasTripped; // Creates the variable.
user_routines.c:22: extern unsigned char aBreakerWasTripped; // Tells the compiler the variable exists in another module.