hi i am programming AT89s52 in C.I am facing a problem in the program.i have declared array in union as shown below
union { unsigned int uiData[100]; }s;
The problem is i have to access this array in a separate file using extern how should i declare it i am trying to access it as shown
for (i=0;i<100;i++) { c=s.uiData[i]; }
but it not working like that anyone can know the solution.plz tell me or any suggestion
I would prefer so large variables to be explicitly placed in specific memory regions instead of just relying on the current memory model.
You do not say why your access code doesn't work - have you remembered to include a header file so the compiler knows about the data type and storage information for the variable?
Always remember to explicitly tell what doesn't work, and any error messages you get. Or what happens and what you did expect to happen.
the compiler does not recognize it undefined Udata
i hve tried this
extern union unsigned char array name
but it doesnt work
and another question why cant we declare union in idata the compiler says it illegal operation
i am using AT89s52 it has 256 RAM .lower 128 direct access and upper 128 through idata.How can i know in which part is causin overflow problem the error is shown below
*** ERROR L107 : ADDRESS SPACE OVERFLOW SPACE : DATA SEGMENT _DATA_GROUP_ LENGTH 0024H Program size : data = 166.6 xdata=0; code= 3917
How can i know in which part is causin overflow problem the error is shown below
As Erik highlighted, the Error message tells you explicitly what has overflowed - it is the DATA space.
It also shows you by how much you've overflowed:
Program size : data = 166.6 xdata=0; code= 3917
You can look in the Linker Listing file (or "Map" file) for more details...