![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Andreas Guest
|
AGAIN : Const Array |
Posted: Sat Sep 04, 2004 4:56 am |
|
|
Hi to all users of CCS C18 !
I am running in the same problem as a lot of other users had allready and after reading 95% of all of this forum I couldnt get a solution.
I need to have a string array with Messages in the flash stored, so if
there is a power shortage no information will get lost.
Here You will find my code, extracted of my large project.
I hope somebody can help me to find my misstake , if there is one.
unfortunatly I have seen today, that there was a bug with large const array fixed in the last version, but as I bought this compiler 34 days ago, I cant get the update without paying again 50% of the new price !!!!!!!
S thank You veray much in advance for every answer which might bring me to a solution.
The problems are commented in the listing.
Best regards
Andreas (Austria)
#include <stdio.h>
char Pin_Def[36][35];
byte const table[5]={1,2,3,4,5};
const char Pin_defF[36][35] = {"Eingang 0 Aktiv , Level ","Eingang 1 Aktiv , Level ",
"Eingang 2 Aktiv , Level ","Eingang 3 Aktiv , Level ","Eingang 4 Aktiv , Level ","Eingang 5 Aktiv , Level ",
"Eingang 6 Aktiv , Level ","Eingang 7 Aktiv , Level ","Eingang 8 Aktiv , Level ","Eingang 9 Aktiv , Level ",
"Eingang 10 Aktiv , Level ","Eingang 11 Aktiv , Level ","Eingang 12 Aktiv , Level ","Eingang 13 Aktiv , Level ",
"Eingang 14 Aktiv , Level ","Eingang 15 Aktiv , Level ","Eingang 16 Aktiv , Level ","Eingang 17 Aktiv , Level ",
"Eingang 18 Aktiv , Level ","Eingang 19 Aktiv , Level ","Eingang 20 Aktiv , Level ","Eingang 21 Aktiv , Level ",
"Eingang 22 Aktiv , Level ","Eingang 23 Aktiv , Level ","Eingang 24 Aktiv , Level ","Eingang 25 Aktiv , Level ",
"Eingang 26 Aktiv , Level ","Eingang 27 Aktiv , Level ","Eingang 28 Aktiv , Level ","Eingang 29 Aktiv , Level ",
"Eingang 30 Aktiv , Level ","Eingang 31 Aktiv , Level ","Eingang 32 Aktiv , Level "};
const char cmd[35][10] = {"test1","test2","test3","test4","test5","test6","test7","test8","test9",
"test10","test11","test12","test13","test14","test15","test16","test17","test18","test19","test20",
"test21","test22","test23","test24","test25","test26","test27","test28","test29","test30","test31",
"test32","test33","test34","test35"};
char temp[16];
typedef struct {
char line[20];
}dLine;
const dLine DisplayMsg[] =
{
{"xEingang 0,Level "},
{"xEingang 1,Level "},
{"xEingang 2,Level "},
{"xEingang 3,Level "},
{"xEingang 4,Level "},
};
BYTE ic;
BYTE i;
Byte c;
Char Level;
Byte index;
Byte Disp;
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DIV_BY_16,0xFF,8);
setup_timer_3(T3_INTERNAL|T3_DIV_BY_4);
setup_ccp2(CCP_PWM);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_timer3(0xFA20);
for (i=0;i<35;++i) // Writing to RAM Array works Fine !
sprintf(Pin_def[i],"Eingang Nr:%2u Level : ", i);
for (ic=0;ic<35;++ic) // Reading from RAM Array works Fine 1
{
fprintf(com1,Pin_def[ic]);
fprintf(com1," \n\r");
}
fprintf(com1," \n\r\n\r");
for (ic=0;ic<35;++ic) // Reading from Flash Array doesnt work !! WHY !!!!
{
strcpy(Disp," ");
strcpy(Disp,Pin_defF[ic]);
fprintf(com1,Disp);
fprintf(com1," %C \n\r",ic);
delay_ms(15);
}
for (i = 0;i<3;i ++){ // Also Reading from const array with this routine doenst work! WHY !!
for (ic=0;ic<18;ic ++)
{
index = DisplayMsg[i].line[ic];
if (!index) break;
fprintf(com1,index);
fprintf(com1," \n\r");
}
}
for (i=0;i < 35;i++) // This is working, but only until it gets to print test26, after that it is
{ // printing only "1" in the next line "2" up to "9" !!!!
strcpy(temp,cmd[i]);
fprintf(com1,temp);
fprintf(com1," \n\r");
}
while(1)
{
} //while(1)
} //main |
|
![](templates/subSilver/images/spacer.gif) |
bdavis
Joined: 31 May 2004 Posts: 86 Location: Colorado Springs, CO
|
|
Posted: Sat Sep 04, 2004 9:08 am |
|
|
I would call CCS and ask them nicely if you can get the previous version that was not beta - I would think they would give you a one day download privledge to do that if you're version doesn't work and it has only been a few days since your download privledges have expired. Then of course hope the non-beta version does work. ![Very Happy](images/smiles/icon_biggrin.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Andreas Guest
|
|
Posted: Sat Sep 04, 2004 10:19 am |
|
|
Thank You bdavis for Your answer, of course I will ask them.
It is just borring to find out, that all the 8 days work would have been done
just by using an older version.
So what is the policy ? Making new bugs to get the customer buying new versions ?????
best regards
Andreas |
|
![](templates/subSilver/images/spacer.gif) |
bdavis
Joined: 31 May 2004 Posts: 86 Location: Colorado Springs, CO
|
|
Posted: Sat Sep 04, 2004 11:04 am |
|
|
I think (?) that they post Beta's to get more testing from others - good for them and good for us. If they would only post known issues as they are found in the current Beta (or all Beta's since last official release). I usually download and save all versions of the compiler, and especially the last official non-Beta release in case I find a bug much further down the road. I think the people that work at CCS are nice, and would think that they could help since it has only been a few days and the official release is several versions older than the current Beta you downloaded. |
|
![](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
|