You're being very sloppy with terms to where it is causing confusion and may be holding back your understanding of what is really going on. Be careful and say things more clearly. That will also help you think more clearly. Matthew Mucker wrote: > I'd like to define a variable in one .asm file OK so far. > and have that symbol > remain defined when another .asm file is compiled. Are you talking about assembler or C or some other high level language? ".asm" implies assembler (MPASM), while "compiled" implies a high level language. So which is it? The operation of assembling or compiling each source file is independent. Anything that might have happened, including various symbols defined, has absolutely no bearing when any other file is assembled or compiled. There are ways to get the linker to fill in references to a variable in one module that was defined in another module, but this happens at link time. You need to understand what the assembler does (since I think you're using MPASM) and what the linker does. Read the manual "MPASM User's Guide with MPLINK and MPLIB". This describes all these things and a lot more you need to know about the assembler and linker. No, there is no shortcut for this. Spend the time and go read. If you don't, you'll end up spending a lot more time in the dark bumping into strange symptoms. > The global/extern constructs only work with labels; I'm still a > little fuzzy on this but I don't think a label is the same as a > compiler symbol. There is too much confusion exhibited here to clear up in a simple email message. Go read the MPASM/MPLINK manual. Again, if you're using MPASM/MPLINK then you're asking about assembler symbols, not compiler symbols. > Here's what I thought would work, but doesn't: > > #define myvariable 123 This probably doesn't do at all what you intended. If you want to define variables, use the RES directive. All the directives are explained in the manual I referenced above. #DEFINE only defines a in-line string substitution macro. This should rarely be used in MPASM. Use RES to define variables and EQU to define integer constants. Defining in-line string substitutions is rarely necessary in MPASM and can lead to trouble. Stay away from #DEFINE for now until you have a solid understanding of what is going on. > #include "myotherfile.asm" This is very different from what you asked about above. You asked about a separate assembly operation, but this just provides more code for the same assembly operation. This is a important distinction. > I figured that by the time the compiler got to building > myotherfile.asm, Again, it seems you're not using a compiler. I will answer what I think your overall question is. Variables are defined in MPASM using RES. If you want a variable to be visible to other independently assembled modules, you have to additionally declare it GLOBAL in the module it is defined in, and EXTERN in the other modules that reference it. RES, GLOBAL, EXTERN, and all the other directives are described in the manual I referenced. Go read it, then come back and ask specific questions. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist