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

How to tread the different memory spaces?

Hello,

Suppose you declare an array in a certain memory space, for instance

unsigned char xdata SendBuffer[ 20 ];
.
Is it allowed to just prototype the callees with
byte *SendBuffer
and dereference it as
TempVal = *( SendBuffer + Counter );
?
Or should it be casted to the correct memory space, like
TempValue = *( (unsigned char xdata*)SendBuffer + Counter );
?
In other words, is the Keil compiler 'clever' enough to see the memory space in the called functions and do the correct memory space conversion itself?
That means, if I declare my SendBuffer in
idata
, will it also work correctly with the same prototype for the callees?

I've run the PC simulator and it seems it works fine, but I just want confirmation.

Rgds,

Geert

Parents Reply Children
No data