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).
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 Translation: "is it reasonable to require me to think?" Erik
Hello Eric, I dont understand your translation, can you elaborate a bit? Thanks and Regards
"I dont understand your translation, can you elaborate a bit?" Although using 'C' relieves you of having to think about a lot of the detail that assembler programming requires, it does not (and cannot) relieve you of all thinking. The compiler can do all the "mechanical" things, but it can't do the things that require real intelligence and original thought - you still have to do that yourself. Deciding which variables to put into DATA and which into IDATA is one such thing.
Using your real/artificial intelligence and original thoughts answer this. Why do have and option for memory model small, medium or Large ? Whatever is your intelligent answer ! Using your "original thoughts" pls think about data and idata. If we need real/artificial intelligence and original thoughts to use idata like unsigned char idata variable; why cannot we extend our real/artificial intelligence and original thoughts for xdata or pdata like unsigned char pdata variable; unsigned char xdata variable; I think only people with real/artificial intelligence and original thoughts can answer this stupid question may be there should be two versions of compiler one with real/artificial intelligence, with all such nonsense options, for dumb people without original thoughts, like me. one with no intelligence, with no such nonsense options, for people with high real/artificial intelligence and original thoughts, Like........ I apologize troubling your real/artificial intelligence and original thoughts.
one with real/artificial intelligence, with all such nonsense options, for dumb people Careful what you wish for. At the point where you just tell the compiler what you want the program to do, software development jobs will have moved to the minimum wage sector.
Be carefull! This can be answered and understood by the peopel with Real/artificial intelligence and original thoughts like.......
How about answering the original question: How do you propose that the compiler should decide which variables to put into DATA and which into IDATA??
Why do have and option for memory model small, medium or Large ? because the '51 ain't no PC why cannot we extend our real/artificial intelligence and original thoughts for xdata or pdata because the '51 ain't no PC may be there should be two versions of compiler impossible because the '51 ain't no PC If you want to program "like for a PC" program a friggin PC, do not try to press your PC philosophy on the '51 because the '51 ain't no PC Erik There is a school of thought states tha "C is C there is no need to know the underlying architecture" Ok there also are things like horsefeathers
kapil singhi wondered: "Why do have and option for memory model small, medium or Large ?" Erik replied: "because the '51 ain't no PC" Actually, PC Development tools do have a similar "memory model" concept! Anyhow, I think the OP's point was not "why do we have memory models at all?" but rather "why do we have only those 3 memory models" and, in particular, why isn't there a memory model that uses IDATA? As I've alreay noted, only one of the four "big" commercial compilers seems to provide an additional IDATA memory model - the other three (which includes Keil) all have just Small (DATA), Medium (PDATA), and Large (XDATA). Must be something in that...?