Hello Everyone, I am writing code for Phillips P89V51RD2 controller. My problem is that when I try to write something like "char IMGdb[900]" , it shows error saying "main : Auto Segment too Large" . Why is this error occuring ? Because, in P89V51RD2, it has a 1 KB RAM, so there should be no problem.
HELLO Dhaval, do you have all the address and data line on the board?
@ ABove : Which data and Address line are you talking about ?
"do you have all the address and data line on the board?"
This is a Compiler error - it has nothing to do with the target hardware!
Remember that the 8051 architecture has several dictinct address spaces (memory areas):
http://www.keil.com/support/man/docs/c51/c51_le_memareas.htm www.8052.com/tutmemor.phtml
When the promotional materials say that the chip has "1 KB RAM" that could be the total of all the RAM - it does not necessarily mean that there is a continuous block of 1K...
Are you sure that you are placing your array in a suitable memory area?
@ Above : Ok,.... I understood what the problem is. I looked at the datasheet and is says that there is standard 128 bytes RAM + 768 bytes of EXTRAM on the chip. So if I want to access this RAM, I have to write "xdata char IMGdb[500]" in the program ? Will this work ?
"I looked at the datasheet"
Yes - that must always be the first thing that you do!
"Will this work ?"
That depends on what you mean by, "work"!
It will place the array in XDATA:
http://www.keil.com/support/man/docs/c51/c51_le_extdatamem.htm http://www.keil.com/support/man/docs/c51/c51_le_xdata.htm
Whether that will "work" in the context of the rest of your application is another matter entirely...
By "work", I meant that whether I will be able to access the memory or not.... I am assuming that the 768 byte memory that I was talking about is the on-chip (XRAM) and can be accessed by defining it as "xdata". But, neway, I will now to load the program to see if it works... :)
Thank you for your reply, Dhaval Mehta mehtadhaval.blogspot.com
Don't assume - check for certain in the Datasheet!
(although, it must be admitted, some datasheets could be much clearer on this issue).
I don't specifically know this chip, and don't have its datasheet to hand to check, but you are most probably correct.
You also need to check the Datasheet to see if there is any configuration that you need to set up (SFRs, etc) before using this memory - if there is, you will need to put it into your startup file before anything makes any attempt to access it
http://www.keil.com/support/man/docs/c51/c51_ap_startup.htm
Yeah, there are some values to be written to Particular SFRs. It is mentioned in datasheet. I will do that.
Yeah, there are some values to be written to Particular SFRs. It is mentioned in datasheet. I will do that. do it in the right place: (a renamed copy of) startup.a51.
doing it in main() will not lead to the expected results
Erik
"doing it in main() will not lead to the expected results"
Depends on view - it would lead to the results you and I would expect ;)
:)