This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

xdata range crossed.

hello,

I have just started using Keil-c51 Eval version 7.50 with uVision for 8051 comptible device.I wanted to use 71M6513 from TDK.But unable to find it from Device Database i have selected closest match 73S11xx .

My simple piece of code lookes like:

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <Reg51.h>

void foo()
{

unsigned char xdata x[10];

unsigned int xdata y[10];

unsigned char xdata z[10];

unsigned char xdata k[10];

unsigned long xdata d;

x[3]=0x07;
y[3]=0x0302;
d=&y[3];
z[3]=0x09;
k[3]=0x10;
}

void main()
{

foo();
printf("hello");

}

I have configured XDATA start as 0x0000 and size as 0x1000...as the XDATA size for the particular device is 4kBytes.

Now this program compiles OK.
When go for step by step Debugging with uVision...and check the local variables there are two doubts come into my mind .They are:

a) for the line d=&y[3] in source code above the result is d=X:0x00010010 ,why the adress of a xdata variable is crossing its maximum limit(max possible limit 64K also) ?

b) When Xdata variable can adress upto 64Kbytes i.e 0xFFFF then why Xdata variable e.g x[10] in above source code shows
starting address of X:0x00000000 i.e 4bytes
why not X:0x0000 2bytes as i feel.??


I will be thankful if any one can pls take some time and clarify me on above two Qs.

Thanks in advance,

Arup

Parents
  • Thanks Mr. Neil for your answer.
    sorry, i should have mentioned "bits" not "byte"
    Yes i understood now that uVision simulates upto 16Mbytes of memory. so whether i am using or not it has kept option for that much space so i am seeing 0x00000000 instead of 0x0000.
    And regarding other question ...i had feeling that any variable can take address value of other variable with "&" operator.It doesn't need to be a pointer type...ok now on i will change the variable to pointer type if it needs to keep address of other variable.

    thanks,
    arup

Reply
  • Thanks Mr. Neil for your answer.
    sorry, i should have mentioned "bits" not "byte"
    Yes i understood now that uVision simulates upto 16Mbytes of memory. so whether i am using or not it has kept option for that much space so i am seeing 0x00000000 instead of 0x0000.
    And regarding other question ...i had feeling that any variable can take address value of other variable with "&" operator.It doesn't need to be a pointer type...ok now on i will change the variable to pointer type if it needs to keep address of other variable.

    thanks,
    arup

Children
No data