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

large (>8k) array in xdata, program running incorrectly

Hi guys,

I tried to construct a waveform with more than 6000 points. the program is like:

arg.h
. .
int xdata wave[6000]
. .
main(){
. .
for...{
wave[i]=i*10;
. }
.

it passed the compiling and linking.
it showed that xdata=12131.
but when i ran the program, it's actually showing a messed up waveform. it only works correctly when i reduced the size of the wave[] to 4000, which makes xdata=8131.

i m using version 7.2, and the xram on the board is 128k. i think it's something missing in the program but couldnt figure it out yet since i m just a beginner of mcu programing in c. any suggestion? i really appreciate it.

Parents
  • i m using the silab f120
    my guess was correct, had you stated your processor in your first post you would be running by now.

    DO NOT set the "memory model SFRs" in main(), you MUST set them in startup.a51.

    mov SFRPAGE,#
    mov EMI0CF,#
    mov EMI0TC,#

    the datasheet will tell you the values that match your app

    Erik

Reply
  • i m using the silab f120
    my guess was correct, had you stated your processor in your first post you would be running by now.

    DO NOT set the "memory model SFRs" in main(), you MUST set them in startup.a51.

    mov SFRPAGE,#
    mov EMI0CF,#
    mov EMI0TC,#

    the datasheet will tell you the values that match your app

    Erik

Children