This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

plz query


sir in my program xdata initialize strating address from 0x20.These external data equalize to some other variable. The example is

unsigned char xdata Dis_data[54] _at_ 0x0200;
M_data = xdata (0x200);


is it possible

Parents
  • - If you want to initialize the data as well as give it a fixed memory location:
    C51 unfortunately does not allow use of both _at_ keyword and a C initializer with the same variable. Use the linker directives to locate your variable.

    - If you want another variable to have the same values;
    Initialize them both the same way. Initializers in C are constants, not executable code, so you cannot write a static declaration such as "U8 myVar = myOtherVar;" Alternatively, you might do the initialization of the second table at runtime, with either assignment or memcpy().

    - If you want two names for the same variable;
    Why? But if you must, consider a #define for the alias.

Reply
  • - If you want to initialize the data as well as give it a fixed memory location:
    C51 unfortunately does not allow use of both _at_ keyword and a C initializer with the same variable. Use the linker directives to locate your variable.

    - If you want another variable to have the same values;
    Initialize them both the same way. Initializers in C are constants, not executable code, so you cannot write a static declaration such as "U8 myVar = myOtherVar;" Alternatively, you might do the initialization of the second table at runtime, with either assignment or memcpy().

    - If you want two names for the same variable;
    Why? But if you must, consider a #define for the alias.

Children
No data