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

Declaring Rom Constants

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







Declaring Rom Constants
PostPosted: Fri Nov 16, 2001 4:22 pm     Reply with quote

Hello
Im new to CCS picc and am using the definition as
given in the FAQ for declaring a few bytes in rom that
I wish to send to an LCD , however the more tables
I add the rom usage stays the same and they all seem
to map in at -009 in the list display
Whats going on , the following compile ok but
dont seem to get into the end result OK

Byte Const TABLE1 [5] = {1,2,3,4,5,0};

Thanks
___________________________
This message was ported from CCS's old forum
Original Post ID: 1160
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Declaring Rom Constants
PostPosted: Fri Nov 16, 2001 4:31 pm     Reply with quote

:=I'm new to CCS picc and am using the definition as
:=given in the FAQ for declaring a few bytes in rom that
:=I wish to send to an LCD , however the more tables
:=I add the rom usage stays the same and they all seem
:=to map in at -009 in the list display
:=Whats going on , the following compile ok but
:=dont seem to get into the end result OK
:=
:=Byte Const TABLE1 [5] = {1,2,3,4,5,0};

If you don't access the table with code, the compiler
will not put the table into ROM.
----------
If you only access the table elements individually,
with a numeric array index, the compiler will not put
the table into ROM. Instead, it will create assembly
code that uses the immediate value which corresponds
to the table element. Example:

c = TABLE1[0];

With the above line, you will just see assembly code
which puts the value at index 0 into variable c.
-----------

If you want to see the entire table in ROM when you
look at the .LST file, then you must use a variable
as the array index. Example:

for(i = 0; i < 6; i++)
c = TABLE1[i];

-----------

If you put in identical tables, the compiler is smart
enough to figure that out, and it will only put one table
into ROM.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1161
John Goss
Guest







Re: Declaring Rom Constants
PostPosted: Fri Nov 16, 2001 5:05 pm     Reply with quote

This is the way I do it... It may help,

I store character messages in a group of statements like below:

const char SelfTestMsg[] = {"SELF TESTING...."};
const char NormalMsg[] = {"NORMAL OPERATION"};

Then I also have a function that can write one character to the LCD called: WriteXLCD();

All I now have to do is:

printf(WriteXLCD,"\%S",NormalMsg)

Hope this helps,
John Goss






:=Hello
:=Im new to CCS picc and am using the definition as
:=given in the FAQ for declaring a few bytes in rom that
:=I wish to send to an LCD , however the more tables
:=I add the rom usage stays the same and they all seem
:=to map in at -009 in the list display
:=Whats going on , the following compile ok but
:=dont seem to get into the end result OK
:=
:=Byte Const TABLE1 [5] = {1,2,3,4,5,0};
:=
:=Thanks
___________________________
This message was ported from CCS's old forum
Original Post ID: 1162
Dara Hayes
Guest







Re: Declaring Rom Constants thanks
PostPosted: Sun Nov 18, 2001 6:07 pm     Reply with quote

John ,
that seems to do the trick
many thanks
Dara Hayes
___________________________
This message was ported from CCS's old forum
Original Post ID: 1207
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