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

When copying an unsigned int the result is byte swapped

Hi,
I am using Cx51v7.20
I have declared a table in battery backed far data memory as an unsigned int table.

unsigned int far fireCalibrationANALOG_FIRE_LINES] _at_ 0x5F0050;

I store data in the table, which is stored in the correct big endian format e.g. 0x07FB
is store at n and n+1 locations as 0x07 0xFB.

So far so good.

At runtime I copy the data to fast volatile RAM. The problem is the compiler swaps the bytes even though the table in fast RAM is decalred in the same manner:

unsigned int far 	levelTables[FLTS_CAL_LEVEL_MAX][ANALOG_FIRE_LINES] _at_ 0x1FC00;

My swap code is simply:
levelTables[FLTS_CAL_LEVEL_SV_OFFSET][adChCount] = svCalibration[adChCount];

Why would the compiler swap bytes if both tables are unsigned int in decalration?

I have tried type casting, taking pointers to the source and destinations, but still
wind up byte swapped to little endian.

Would anyone have run across this before?

Thanks for any help ANYONE can give.

Bill Bynum

0