Hi,
This is my code:
#define NUMBER_OF_ROWS 50 #define NUMBER_OF_COLS 2 unsigned int Array[NUMBER_OF_ROWS] [NUMBER_OF_COLS] = { {100,50}, {20 ,10 }, {16 , 8 }, {14 , 7 }, {12 , 6 }, {11 , 5.5 }, {10 , 5 }, {9.1, 4.55}, {2 , 1 } and so on until 50 rows..};
The problem is I have 50 elements needed for a lookup table, but the following error occur: Array.h(57): error C242: 'array[]': too many initializers
When I initialize number of rows to 45, no error prompt. I need to use all the 50 elements. Is this the only way for me to create a lookup table? Can someone guide me on using more simpler method? Please help me. Thanks.
It isn't impossible for a compiler to complain if a data structure is too large compared to the intended use. After all - it's the compiler who needs to consider instructions to address the individual data of the data structures.
But it's not complaining about size - it's complaining specifically about number of initialisers...
Thanks for the reply guys. I have solve the problem. It is in the setting. the 8051 have 64K of memory, where when you create a project, it will automatically set the limitations to 2K. What I did is change the 2K to large data setting in Keil.
About the floating value, I store the floating value inside an array, but there is a formula calculation which I created will take the floating value and it works well.
Thanks Guys! :D
Guys, another one. How can I create .dll file in Keil from my existing project?
I store the floating value inside an array, but there is a formula calculation which I created will take the floating value and it works well. Better have a check. Why not have array of 'float' type instead of 'int'?
View all questions in Keil forum