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.
"Is their any sample code."
Have you looked for any?
"How to use the internal XRAM of 89c51re2."
That is entirely down to the 89c51re2 and completely unrelated to whatever language and tools you use.
The Datasheet for the 89c51re2 will tell you what is necessary.
The Manuals for the tools that you're using will tell you what facilities they have for accessing SFRs, and the different memory areas of the 8051 architecture.
I have set AUX = 0x1C and AUXR1 =0xc0 as given in datasheet, still the program does not work.
Time to debug it, then!
if I want to store a variable char temp=[1024] in the internal 8k of 89c51re2? how do i do it using keil uvision2 any idea? what setting I have to in the project/code
char temp=[1024]
What language is that then?
Start here: http://www.keil.com/support/man/docs/uv4/uv4_ex_hello.htm
Other examples: http://www.keil.com/support/man/docs/uv4/uv4_examples.htm
Complete uVision Manual: http://www.keil.com/support/man/docs/uv4/
C51 Manual: http://www.keil.com/support/man/docs/c51/
C51-specific extensions - including how to access the different 8051 memory areas: http://www.keil.com/support/man/docs/c51/c51_extensions.htm
The "legacy" uVision-3 manuals are still available here: http://www.keil.com/support/man/docs/uv3/
If you have uVision-2 (which was replaced by uVision-3 several years ago), then you will have the appropriate PDF manuals on your hard drive in your Keil folder...
Oh!. it is defined as xdata char temp[1024];, I do not have external memory on board, I want to store this variable in the internal 8k xram of 89c51re2. I have a anothrt board for AT89c51rd2 with external memory interface. The program works on 89c51rd2 but not on 89c51re2.Since I am using xdata the varibale is stored in the external memory, How do I make the varibale store in internal 8k ram of AT89C51RE2 ?
"How do I make the varibale store in internal 8k ram of AT89C51RE2 ?"
Look at the startup file.
Incorrect - read the C51 documentation again, carefully.
xdata is simply memory that is addressed using the MOVX instruction - it is irrelevant whether that memory is physically "internal" or "external" to the chip itself. It's a matter of addressing - not physical location.
You also need to carefully study the processor's datasheet to see where the on-chip XDATA memory appears in the XDATA address space, and any other limitations on its use...
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.