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 CCS Technical Support

Static values in ROM

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



Joined: 09 Feb 2009
Posts: 12

View user's profile Send private message

Static values in ROM
PostPosted: Tue Feb 10, 2009 10:44 am     Reply with quote

I'm brand new to the PIC and CCSC tools (I have over 20 years with Moto hc05 & hc11, and Cosmic compilers), so please excuse these newbie questions.

How can I store a string (that won't ever get used) in ROM? With other compilers a simple

Code:
const char copyright[]="XYZ (C) 2009";


would do the trick. But the CCSC compiler "optimizes" the code and doesn't include it in the final HEX output.

Using

Code:
#ROM 0x1ff0={'X, 'Y', 'Z', ' ', '(', 'C', ')', ' ', '2', '0', '0', '9'}


causes 4 bytes per character to be stored in ROM.

Any advice would be appreciated,
_________________
Calvin
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 10, 2009 12:51 pm     Reply with quote

Use the 'rom' qualifier instead of const. Example:
Code:
#include <18F452.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000) 

int8 rom array[] = {"123456"};
   
//====================================
void main()
{

while(1);     
}

The data is placed in high memory, at the end of ROM:
Quote:

:020000040000FA
:1000000002EF00F0F86AD09EEA6AE96AC180C18214
:08001000C184C196FFD7030073
:077FF800313233343536004D
:020000040030CA
:0E00000000210E0E000181000FC00FE00F4026
:00000001FF
;PIC18F452
;CRC=7CD5 CREATED="10-Feb-09 10:37"
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