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

save ROM ?

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



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

save ROM ?
PostPosted: Sun Jan 01, 2012 2:19 am     Reply with quote

i can save ROM ? when i use some MSG Defines on RAM .like this
Code:
/*****************************************************************************
   MSG Defines on RAM
 ****************************************************************************/
#define msg_1[]= "NORMAL_VOLTAGE";
#define msg_2[]=" HIGH_VOLTAGE";
#define msg_3[]=" LOW_VOLTAGE";
#define msg_4[]=" CUT OFF";


save ROM .like this
Quote:
lcd_init(); // Always call this first.

lcd_putc("\f msg_2\n");
lcd_putc("msg_4");

in place of
Quote:
lcd_init(); // Always call this first.

lcd_putc("\f HIGH_VOLTAGE\n");
lcd_putc("CUT OFF");

what I'm doing right ?
if not ....pl help me
_________________
sahu
Ttelmah



Joined: 11 Mar 2010
Posts: 19346

View user's profile Send private message

PostPosted: Sun Jan 01, 2012 3:25 am     Reply with quote

No.
The message still has to be stored in the ROM. #define is a _pre_ compile stage. Things 'defined', are replaced with their definitions, _before_ the compiler actually runs.
The messages have _got_ to be stored in ROM, or they will just be lost. If you declare a RAM variable, holding a message, the message is first stored in ROM, then copied to RAM when the chip boots, so you end up wasting RAM as well....
The syntax won't actually work anyway, but there would be no saving it it did.

Best Wishes
sahu77



Joined: 08 Sep 2011
Posts: 202

View user's profile Send private message

PostPosted: Sun Jan 01, 2012 12:28 pm     Reply with quote

its means my method r wrong ?
_________________
sahu
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sun Jan 01, 2012 3:32 pm     Reply with quote

If you are only going to use the text once it has to be stored somewhere and it doesn't matter much how.

If you are going to use the same text in many locations you can have one copy in ROM and use it from those locations. But using a #define is not the way to do that.

Tell us more about your application.
_________________
The search for better is endless. Instead simply find very good and get the job done.
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