Jump to content
Sign in to follow this  
marcob

Rom Data

Recommended Posts

Hi.

 

I have two Test string in rom.

I want to load one with the two stringhe in one const char , but is not possible.

 

 

rom char *ms1= "hello";

rom char *ms2= "HELLO";

const char *mess;

 

// Main program entry

 

void main()

{

if (.....)

*mess = *ms1;

else

*mess = *ms2;

 

How to solve this !

 

regards marco

Share this post


Link to post
Share on other sites
I think that the problem is at the line:

 

const char *mess;

 

Why do you declare as "const" ?

 

Yes, there was an error in the code. The correct code is like this:

 

rom char* ms1 = "XXX";
rom char* ms2 = "YYY";
char* msg;

main ()
{...
msg=ms1;
}

 

In this case, if I try to display in an LCD the value of msg, nothing appears. Instead if I remove ms1 and ms2 from rom in this way

 

char* ms1 = "XXX";
char* ms2 = "YYY";
char* msg;

main ()
{...
msg=ms1;
}

 

the program works correctly.

Can you explain me how to use the variables put in rom memory? Thank you, bye

Edited by marcob

Share this post


Link to post
Share on other sites

Try this

 

rom char *ms1= "hello";
rom char *ms2= "HELLO";
rom char *mess;  // change const char * to rom char *

// Main program entry

void main()
{
if (.....)
*mess = *ms1;
else
*mess = *ms2;

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...