We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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 <pre> and </pre> 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]; }
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]; }
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