CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

const table

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cmanu



Joined: 11 Mar 2004
Posts: 2

View user's profile Send private message

const table
PostPosted: Thu Mar 11, 2004 4:12 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 11, 2004 11:40 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 12, 2004 1:48 am     Reply with quote

Thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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