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

Indexing large arrays

I want to have an array that is larger an 65535 bytes. I need to be able to address this array a byte at a time.

Can I simply use a index that is defined as a long? Do I have to break the array up into two parts - the first 64K and "the rest"? What is the best way to do this?

Thanks in advance.

Parents
  • Note that we do support XDATA banking in the latest tools. This is a NEW feature and there isn't a lot of documentation available for it, yet. However, it also isn't all that complex.

    Take a look at the latest newsletter:

    http://www.keil.com/newsletters/2001sp_keil.pdf

    Page 2 documents how to configure generic 24-bit pointers for ANY 8051-compatible part.

    To summarize, there is a configuration file named XBANKING.A51 found in the \KEIL\C51\LIB directory. This file contains routines that read and write bytes, words, and dwords using 24-bit addresses.

    In your C code you simply refer to these as far data types. For example:

    unsigned char far big_array [1234];
    

    Once you've configured XBANKING for your hardware, the compiler and linker do everything else.

    The size of individual objects is still limited to 64K. So, if you want a big array, you'll have to do it with pointers.

    Jon

Reply
  • Note that we do support XDATA banking in the latest tools. This is a NEW feature and there isn't a lot of documentation available for it, yet. However, it also isn't all that complex.

    Take a look at the latest newsletter:

    http://www.keil.com/newsletters/2001sp_keil.pdf

    Page 2 documents how to configure generic 24-bit pointers for ANY 8051-compatible part.

    To summarize, there is a configuration file named XBANKING.A51 found in the \KEIL\C51\LIB directory. This file contains routines that read and write bytes, words, and dwords using 24-bit addresses.

    In your C code you simply refer to these as far data types. For example:

    unsigned char far big_array [1234];
    

    Once you've configured XBANKING for your hardware, the compiler and linker do everything else.

    The size of individual objects is still limited to 64K. So, if you want a big array, you'll have to do it with pointers.

    Jon

Children