We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hallo everybody, can anybody help me. I want to save Constants on the XRAM. How does this works?
Refer STRING directive in C51 user manual.
I want to save Constants on the XRAM. What exactly do you want to accomplish ? Putting constants in XRAM does not make much sense except in fairly exotic circumstances (for example: All code memory is used and you want to store a table in XDATA that is generated by an algorithm at bootup). XDATA, on most devices, is volatile and will lose its contents during a power cycle. That aside, there is nothing that stops you from declaring a constant in XDATA
const char xdata myconst = 0xA5;
const char code myconst = 0xA5;
the directive XCROM can also helps you
How can I know, at with Adress I can storage my constant?
How can I know, at with Adress I can storage my constant? In most cases, the linker does this for you and you do not need to worry about it. Where the linker put what can be found in the linker listing file (*.m51). If you need to place the constant at a particular address, refer to the linker documentation on how to do it.
U by ur self also can specify it by using the absolute address refer to keil user guide volatile and _at_ will help u
"Putting constants in XRAM does not make much sense except in fairly exotic circumstances (for example: All code memory is used and you want to store a table in XDATA that is generated by an algorithm at bootup)."
Another example would be where you have non-volatile memory in XDATA space.
If part of your ROM is mapped into XDATA space, that's where the XCROM directive comes in...
It'd help if you said what you're actually trying to achieve - then people could make informed suggestions!