|
|
View previous topic :: View next topic |
Author |
Message |
cmanu
Joined: 11 Mar 2004 Posts: 2
|
const table |
Posted: Thu Mar 11, 2004 4:12 am |
|
|
Hi
I use a 16F76 and the CCS's version 3.185
I have defined a const table like this:
const char cName[40][3][17] =
{
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"},
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"},
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"},
...
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"}
}
When I compile I have "Subscript out of range"
I try
const char cName[5][3][17] =
{
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"},
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"},
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"},
...
{"Xxxxxxxxxxxxxxxx","Yyyyyyyyyyyyyyyy","Zzzzzzzzzzzzzzzz"}
}
It's work
The difference I see is that the table is 255 octets in the second test.
I try #device *=16 and have the same problem.
Someone can help me? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 11, 2004 11:40 am |
|
|
I don't think that CCS permits a const array to be larger than
a ROM page, which in your case is 2048 bytes.
Each of your strings is 17 chars long. Plus, each one has a 0
on the end, to make it a string. Also, the compiler adds at least
4 instructions to the beginning of each string, to allow it to get
chars from the string. So that's 21 ROM words per string.
That gives 40 x 3 x 21 = 2520 which is greater than 2048. |
|
|
cmanu
Joined: 11 Mar 2004 Posts: 2
|
|
Posted: Fri Mar 12, 2004 1:48 am |
|
|
Thanks |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|