How do I use a variable that is defined in a .C file in a .asm file of the same project?
If a variable is declared in the .c file, no memory allocation is needed in the .asm file. Make sure to declare your variable outside of any functions so that it is global. Assembly is able to see all global variables, so we do not need to tell it about an “external” variable declaration. We must make sure that when we call it in the .asm file, we use with “_”.
In a C file following global variable is declared:
To use it in assembly, just add an underscore and use the variable:
mov [ _OperandTwo],0x00
For more information on interfacing C and assembly functions, please refer to the application note, AN2129, at the following link: