|
|
View previous topic :: View next topic |
Author |
Message |
ckrusen
Joined: 09 Feb 2009 Posts: 12
|
Static values in ROM |
Posted: Tue Feb 10, 2009 10:44 am |
|
|
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
|
|
Posted: Tue Feb 10, 2009 12:51 pm |
|
|
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" |
|
|
|
|
|
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
|