actually this is in reference to the thread that i have already created about declaring two dimensional arrays I have configured the the model to Xdata and the change that i have made is only of declaring a character array of a size more than 100 Yes i am going to use it to store strings but that is later isnt it .There is a problem in the declaration itself
It really would be better to continue with the already existing thread. Still, we are here now... xdata is not a memory model. Do you mean that you are using the large memory model? The fact that you get problems as the array gets bigger rather hints that variables are not being stored where you think they should be. You can use the simulator Memory Window to check. You can put strings in a two dimensional array. However, it is generally better to form an array of pointers to strings. The difference is a subtle one and may result in some confusion. Can you post some of your code - let us see that array definition and how you are accessing it.
3 #include<stdio.h> #include<conio.h> void main() { char xdata id[100][20];/*this code is producing a problem*/ char id1[50]; struct { emp[10]; nm[20]; }str[10]; //also dose not work why?? } }
OK, let's take this one step at a time. What is the problem that is being produced?
#include<conio.h> Do you really have that line in your code?
well that code was done firstin c and then transferd on to keil
Please post code etc using <pre> and </pre>. None of your code seems to operate on Id1. So, what is your program doing that you are not expecting?
the code dose not exicute instead the LCD on port one is bank and leds on port 0 go on and off
Does it work with a smaller array size? If so, how large is the maximum array size?
Yes it works with a arr of [20][20] but any greater it dose not work
which chip ? which external RAM ? Erik
Why do you think it doesn't work? Hint: RAM comes in finite amounts.
RAM comes in finite amounts Erik will never make a PC programmer out of you as long as you insist on thinking like that. A gigabyte here, a gigabyte there, pretty soon you're talking about real memory.
After looking at the hex file, I found the problem! I lost interest in looking at the hex file! Seriously though, your micro has 2048 bytes of xram so your array cannot be much bigger than your 100 * 20. Firstly, where has the linker put your array? What memory model have you selected? Tiny? - that's definitely not going to work. Read up on the linker output, it tells you many things. Secondly, does the 89c51rd2 need a bit set to enable the xram? I know aduc834 does and a 89c668 does. Read the datasheet on your device. Putting the hex file on the forum was a waste of time! If you'd put the linker listing, that would have been much more helpful.
View all questions in Keil forum