Quote:
|
Originally Posted by seanwitte
Declare the variable you want to share between files in a header file with the "extern" storage specifier. For example:
extern unsigned char MyVar;
In a source file that includes the header, define the actual variable:
unsigned char MyVar;
|
If the interupt fire enough, you will want to declare it volatile. ie,
Code:
/*** Variables.h ***/
volatile unsigned char MyVar = 0;
/*** MyCode.c ***/
extern volatile unsigned char MyVar;
This will cause it to not copy the value to a temporary storage location.