Hello, i am using 8052 in my project and according to datasheet the data memory is 256 bytes but in my code if i exceed 128 bytes the code is not compiled do i need to use it as x data memory? please help
if i exceed 128 bytes the code is not compiled Before anybody believes that claim of yours, you'll have to show proof. E.g. a small example program and the actual error message you got that made you conclude the program had not been compiled.
You do realise that only the first 128 bytes are directly addressable - what Keil calls DATA space? The next 128 bytes are only indirectly addressable - what Keil calls IDATA space. For example, if you have tried to define an array of >128 bytes in DATA space, this probably will cause the compilation to fail. If you don't understand the above, you need to read the so-called "bible" for the 8051: Chapter 1 - 80C51 Family Architecture: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf Chapter 3 - 80C51 Family Hardware Description: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf You should also look at these Tutorials: http://www.8052.com/tutorial.phtml And read the uVision Getting Started Guide, and work through the example projects in it. This will give you a proper introduction to the tools, how they work, and how to use them - rather than just jumping-in blindly at the deep end. (The uVision Getting Started Guide is available on the 'Books' tab in the 'Project' Window; The 'Books' window is also available via the 'Help' menu; failing all that, search for GS51.PDF in your Keil folder)
Thanks Neil for your quick response but i sincerely feels, that when compiler is aware of that there are two sections of ram available with the selected microcontroller ( 8052) why the hell is it need to be informed to keep extra varilable in in the extended memory No doubt the access will be solwer in this case of access made to the extended 128 bytes that the first 128 bytes. but compiler should offer us an option of keep in variable in extended memory without using the "idata" in front of every variable I understand the questions asked by me was stupid becaues in assembely language we are ware of using it with the help of @r0 or @r1 but i was really confused and surprised that i really have to mention the "idata" for such variables and compiler is simply dormant for this overflow why the hell compiler cannot use idata memomery itself?
How do propose that the compiler should decide which variables to put into DATA and which into IDATA??
If the compiler automatically allocated variables to idata and data, the first feature demanded would be a way to control which variable went into which memory space. I can see the post now -- "Why doesn't Keil add some keywords so I can force a variable into a particular memory space?" The two memory spaces have distinctly different access methods, with different overhead in both code space and time. If variables moved back and forth at the whim of the compiler, your program would constantly be changing size and timing for no apparent reason. Certainly, a good program wouldn't depend on that sort of behavior. On the other hand, it would be one of those hassles you don't need while staying up late trying to work out a bug. Data space is a precious commodity that often needs to be carefully allocated. A really smart compiler might be able to work out all the tradeoffs between frequency of access, speed of access, code size, and so on. But that involves understand very high level semantics of the program. As a programmer, I'd certaily want a way to override any such judgements when I disagree with the way the optimizer optimizes. It might be a nice luxury to have a "don't care" memory address space assignment keyword, so the compiler could put it in data, idata, or xdata at its whim. U8 data oftenAccessed; U8 any whoCares;
Perhaps a 4th Memory Model that defaults everything to IDATA? (Neither Raisonance nor Tasking seems to offer such a model, but IAR does).
View all questions in Keil forum