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 increase my array size?

I want to include a hexidecimal array into my c code. The hexidecimal array has about a thousand elements in it. The compiler would not let me do it. I am using a 89C664 microprocessor. I want to know how I can compile it with this hexidecimal array.

  • Precisely what error(s) did you get?
    Precisely what do you mean by "about a thousand?"

    Post a small code sample (not forgetting to use the &ltpre&gt and &lt/pre&gt tags, of course - see the Tips for Posting Messages in the sidebar)

    You won't get an accurate answer from a vague question! ;-)

  • void main (void){
      char i = 0;
      char jbi_program[1000];
    
    }
    
    

    The error is "'main': auto segment too large"

    This array contains hexidecimal values used to program another chip. I am using a 89C664 microcontroller.

  • Unless specified otherwise, variables are stored in the default memory space for the selected memory model.

    You will either need to use the Large memory model, or explicitly define your array to be in xdata:

    void main (void){
      char i = 0;
      xdata char jbi_program[1000];
    
    }

    Look up the sections on Memory Models and Memory Types in the manual

  • As Andrew's post demonstrates, C51 is *not* ANSI/ISC C when you really have to do real work. Try recursing a function an watch what happens without the non-ANSI keyword 'reentrant'.

    I type *all* my variables with code, data, idata, xdata, etc. And disable ANSI integer promotion if you want to gain some performance.

    Regards.

    - Mark