|
|
View previous topic :: View next topic |
Author |
Message |
Dara Hayes Guest
|
Declaring Rom Constants |
Posted: Fri Nov 16, 2001 4:22 pm |
|
|
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
|
Re: Declaring Rom Constants |
Posted: Fri Nov 16, 2001 4:31 pm |
|
|
:=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 |
Posted: Fri Nov 16, 2001 5:05 pm |
|
|
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 |
Posted: Sun Nov 18, 2001 6:07 pm |
|
|
John ,
that seems to do the trick
many thanks
Dara Hayes
___________________________
This message was ported from CCS's old forum
Original Post ID: 1207 |
|
|
|
|
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
|