![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Patrick Frank Guest
|
How big maximum string arrays? |
Posted: Tue Mar 30, 2004 3:41 am |
|
|
Hi,
am using string array to save different languagges in my program.
Now i have a problem with the maximum size.
This works:
Code: | const char sprachemess[2][7][12]=
{"Modus CH1","Modus CH1/2","PNP","NPN","Geschw:","Zeit:","Entf:",
"Mode CH1" ,"Mode CH1/2" ,"PNP","NPN","Spd.:" ,"Time:","Dis.:"};
|
This not:
Code: |
const char sprachesetup[2][11][17]=
{"Abstand Sensoren","Flankentrigger","Anzeigeeinheit","Messmodus" ,"Trigger auf:","positive Flanke","negative Flanke","Anzeigeeinheit","Messmodus" ,"Eine Messung","Endlos Messung",
"Distance" ,"Pulse" ,"Speed Unit" ,"Measurement","Trigger:" ,"pos. Pulse" ,"neg. Pulse" ,"Speed Unit" ,"Measurement","Single" ,"Continue"};
|
It occurs an error: Subscript out of range.
Has anybody i idea what i can do, apart from making the arrays smaller?
How big is the maximum size for string arrays?
Best regards
Patrick Frank |
|
![](templates/subSilver/images/spacer.gif) |
random_person Guest
|
|
Posted: Tue Mar 30, 2004 4:28 am |
|
|
the maximum size for a char array will depend on the device you're using, and how much ram you have left to use in your program.
I don't think arrays can reach across banks. According to the CCSc.hlp file Quote: | Subscript out of range
A subscript to a RAM array must be at least 1 and not more than 128 elements. Note that large arrays might not fit in a bank. ROM arrays may not occupy more than 256 locations.. |
So your array of characters is probably too bigfor the device/compiler to fit in one bank. I'm guessing that each character would occupy one "location"...or general purpose register of the PIC.
If using strings like that are absolutely necessary, you'll probably need external ROM to hold the data. If you are interfacing with a PC via something like RS232, consider holding the string arrays on the PC and an index system on the PIC. but i'm really not sure thats the nature of your project.
i hope that was somewhat helpful. |
|
![](templates/subSilver/images/spacer.gif) |
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Tue Mar 30, 2004 4:36 am |
|
|
Since you are using the keyword const your array will be placed in ROM. So the limit will be 256 locations and the RAM bank limit doesn't apply here. Try to break your array into two smaller ones. |
|
![](templates/subSilver/images/spacer.gif) |
random_person Guest
|
|
Posted: Tue Mar 30, 2004 5:20 am |
|
|
Haplo is absolutely right. I didn't notice nor realize the arrays were consts and they are put in ROM. CSS-C treats dynamic indexing of these array as a simple table lookup function in assembly. You would thus be limited to a page (256) of elements for such an array within CSS-C confines.
so forget what I said previously. ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Patrick Frank Guest
|
|
Posted: Tue Mar 30, 2004 5:46 am |
|
|
Hello,
thanks for the response.
I am using a PIC 16F876 and these Strings are for a Language Selection at the 4*16 LCD.
Ok, then i break the Arrays down into smaller ones.
Thanks
Patrick |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|