julioc Guest
|
Canīt allocate multiple Byte CONST tables: CORRECTED POST |
Posted: Sat Mar 25, 2006 9:20 am |
|
|
Hi, correcting a cut-and-paste error of the previous version of this post:
I am using a 16F688 and I have a need for storing 64 tables of 17 bytes each one.
At first I tried to merge those 64 tables in single a big table like this:
BYTE CONST T_TMAP [64 * 17] =
{ /* ... */ };
But it didnt even compile, because the preamble code that the compiler automatically inserts to access table element canīt deal with more than 255 elements.
OK, then I tried to split the big table into 8 smaller tables, like this:
BYTE CONST T_TMAP0 [8 * 17] =
{ /* ... */ };
BYTE CONST T_TMAP1 [8 * 17] =
{ /* ... */ };
BYTE CONST T_TMAP2 [8 * 17] =
{ /* ... */ };
BYTE CONST T_TMAP3 [8 * 17] =
{ /* ... */ };
BYTE CONST T_TMAP4 [8 * 17] =
{ /* ... */ };
BYTE CONST T_TMAP5 [8 * 17] =
{ /* ... */ };
BYTE CONST T_TMAP6 [8 * 17] =
{ /* ... */ };
BYTE CONST T_TMAP7 [8 * 17] =
{ /* ... */ };
Well, it compiled fine, no errors or warnings, but... The compiler allocated adequately T_TMAP0 and T_TMAP1 in the ROM, but it simply didnt allocate T_TMAP2 .. T_TMAP7! It should have issued at least an error or warning!
I could notice that this line of my code:
return T_TMAP0 [index];
generates the following assembly table read call : "call 052"
return T_TMAP1 [index];
generates the following assembly table read call : "call 0DE"
and all the lines
return T_TMAPx [index]; // where x = 2, 3, ... 7
generate the same following assembly table read call : "call 0DE"
as if the 6 last tables were all assimilated by the compiler to be identical to T_MAP1 !!
Please, folks, what am I doing wrong, or what workaround should I use to have those tables allocated ?
My compiler version is 3.235.
Thanks! |
|