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

Problem about access values stored in xdata

Dear sir,i use uVision IDE for 8051 ver 6.20c. I used AT89C81. My problem is, i want to store 25 integer value in an array called melody. When i tried to write code in following way, i get error "adress space overflow".
-############################

int rit[] = {6, 12, 12, 6, 12, 24, 24, 18, 18, 18, 12, 12, 6, 12, 8, 8, 8, 12, 6, 12, 12, 6};

-############################
Then i used XDATA memory to save my integer values. In order to do that i wrote following code segment instead of previous one.
-############################

unsigned long int xdata rit[25] = {6, 12, 12, 6, 12, 24, 24, 18, 18, 18,12, 12, 6, 12, 8, 8, 8, 12, 6, 12,12, 6, 6, 6, 12};

-############################

Compiler seems happy because i got no error*1, moreover as far as i understand those values is stored in XDATA memory.However, when 8051 try to access those value, simulation does not works fine because 8051 could not get those values which is stored in XDATA.

The code below shows how i try to get those integer values.

-############################
int i; for ( i=0; i<24; i++) { int tempo = rit[i];
-############################

Any help would be appreciated.
Mert Özbek

*1:

Rebuild target 'Target 1'
compiling Sound_Motor.c...
linking...
Program Size: data=31.0 xdata=200 code=909
creating hex file from "ServoSound"...
"ServoSound" - 0 Error(s), 0 Warning(s).

Parents
  • First if these are the numbers us unsigned char, it takes less space. and process a whole lot faster

    Clarification
    Second if the melody does not change store it in ROM
    Second if THIS melody does not change store it in ROM, if you have multiple melodies, you will still store them in ROM

    Erik

Reply
  • First if these are the numbers us unsigned char, it takes less space. and process a whole lot faster

    Clarification
    Second if the melody does not change store it in ROM
    Second if THIS melody does not change store it in ROM, if you have multiple melodies, you will still store them in ROM

    Erik

Children
No data