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

Pointer to a string table

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







Pointer to a string table
PostPosted: Mon Oct 23, 2006 9:12 am     Reply with quote

hello, I use PICC 3.202 for PIC16F877A

I have a problem, the compiler don't want to recognize the following construction:
Code:

const char* const message_lcd[] =
{
   " FONCTIONNEMENT     MODE PC     ",   //0
   "TEST ETANCHEITE MASQUE          ",   //1      MESSAGES "TEST ETANCHEITE MASQUE"
   "-",                        //2
   " mbar      DEGONFLER       ",      //3
   " mbar      REGONFLER       ",      //4
   " mbar      APPUYER SUR <E> ",      //5
};


I tried to use
Code:

char const message[][]=
{
   " FONCTIONNEMENT     MODE PC     ",   //0
   "TEST ETANCHEITE MASQUE          ",   //1      MESSAGES "TEST ETANCHEITE MASQUE"
   "-",                        //2
   " mbar      DEGONFLER       ",      //3
   " mbar      REGONFLER       ",      //4
   " mbar      APPUYER SUR <E> ",      //5
};

it doesn't work. can anyone help me? I want to put in RAM a string table and I can't do it.
Alexei
Guest







PostPosted: Mon Oct 23, 2006 9:14 am     Reply with quote

sorry, I want to put a string table not in RAM but in ROM.
Neckruin



Joined: 17 Jan 2006
Posts: 66

View user's profile Send private message

PostPosted: Mon Oct 23, 2006 10:04 am     Reply with quote

I have also tried to allocate a bidimensional array in ROM but wasn't able to do it Sad
I finally used single arrays.
I hope somebody can help you (or "us")

Good Luck,

Juanma
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 23, 2006 10:50 am     Reply with quote

The program shown below works OK. It displays the following output.
Code:

FONCTIONNEMENT     MODE PC     
TEST ETANCHEITE MASQUE         
-
 mbar      DEGONFLER       
 mbar      REGONFLER       
 mbar      APPUYER SUR <E>


Here is the program. It was tested with PCH vs. 3.249.
Code:

#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP, NOPROTECT, CPB
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

char const message[6][33]=
{
   " FONCTIONNEMENT     MODE PC     ",   //0
   "TEST ETANCHEITE MASQUE          ",   //1   
   "-",                        //2
   " mbar      DEGONFLER       ",      //3
   " mbar      REGONFLER       ",      //4
   " mbar      APPUYER SUR <E> ",      //5
};

//====================================
void main(void)
{
int8 i;

for(i = 0; i < 6; i++)
   {
    printf("%s\n\r", message[i]);
   }

while(1);
}
Mark Weir



Joined: 11 Sep 2003
Posts: 51
Location: New Zealand

View user's profile Send private message

Question
PostPosted: Tue Oct 24, 2006 5:53 pm     Reply with quote

Hi,

My question is really to PCM. I have tried the piece of code you supplied in answer to this post and of course it works well. Could you please tell me about the range of the two parameters. This setup has 6 messages of up to 33 characters if I understand correctly. If I want to have 20 messages, say, will they have to be shorter or can the range be extended?

Cheers

Mark
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 24, 2006 10:21 pm     Reply with quote

For the PCM compiler, the size limit is 256 bytes for a ROM array.

For the PCH compiler, it's much larger. I don't know what the limit is
because I haven't run up against it yet. It works with at least 1KB.
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