I am using AT89C51RE2 AND KEILuvision4. I am trying to use 8k internal xram. Is their any sample code. How to use the internal XRAM of 89c51re2.
"How do I make the varibale store in internal 8k ram of AT89C51RE2 ?"
Look at the startup file.
Q: "How do I make the varibale store in internal 8k ram of AT89C51RE2 ?"
A: "Look at the startup file."
Incorrect!
The starup file does not control where variables are stored - that is done by the Linker/Locator.
But the startup file does need to ensure that everything is correctly configured to enable access to whatever memory (or memories) are present in the target hardware - the uVision Project settings do not do this for you!
<quote> Q: "How do I make the varibale store in internal 8k ram of AT89C51RE2 ?"
Incorrect! </quote>
I think that's a bit strong :(
Not really incorrect is it? I think it's highly likely he has not enabled the internal RAM or done it wrong. This is normally/typically be done in the startup file.
"Not really incorrect is it?"
Well, it is true to say that the startup file has no effect on where variables are placed - which was the specific question that you quoted.
So if, for example, the project is incorrectly configured such that the Linker is locating variables outside the address range of the internal XRAM - then the startup file will tell him nothing at all.
"I think it's highly likely he has not enabled the internal RAM, or done it wrong"
Yes, that is quite likely.
"This is normally/typically be done in the startup file."
Yes, that is true.
It does (in some ways)
If startup (or default) does not enable the internal XRAM the xdata is not cleared and initialized variables are initiaslized into thin air.
Erik
"If startup (or default) does not enable the internal XRAM the xdata is not cleared and initialized variables are initiaslized into thin air."
Yes - but that has nothing to do with the placement of the variables into XDATA in the first place.
It is the Compiler that decides (or is told) which memory space (DATA, XDATA, etc) a variable is to go into;
It is the Linker/Locator that decides (or is told) which memory address (within its memory space)to assign to a variable.
None of the above has anything to do with the startup code.
Of course, if the startup code is wrong, runtime accesses to the memory spaces and/or addresses assigned by the compiler & linker are likely to fail.