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

Placing arrays in ROM, instead of RAM?

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







Placing arrays in ROM, instead of RAM?
PostPosted: Sat Jul 12, 2003 8:11 am     Reply with quote

Hello,

I created an array around 70 bytes in size, using the following declaration:

byte my_array[]= {1,2,3,4,...}

I believe it is placed in RAM. Since I will not be modifying this array, and rather keeping it "constant", is there a way I can tell the CCS compiler that I want it to reside in ROM instead of using up RAM? I remember back in my assembly programming days, I can use the instruction "RETLW 0x23" to burn in 0x23 at that place in ROM.

Basically, what i'm asking is how to put a constant lookup table in program memory's (?) ROM, using CCS #directives.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515906
john cutler



Joined: 06 Sep 2003
Posts: 82
Location: Hot Tub, California

View user's profile Send private message

Re: Placing arrays in ROM, instead of RAM?
PostPosted: Sat Jul 12, 2003 9:07 am     Reply with quote

look at page 214 of the current manual !
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515907
Darren Logan
Guest







Re: Placing arrays in ROM, instead of RAM?
PostPosted: Sat Jul 12, 2003 2:07 pm     Reply with quote

Watto!

this...

byte const defaults[17]={1,1,1,1,1,37,3,0,0,115,120,29,0,10,0,0,143};

...does go into ROM automatically.

Regards,
Darren
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515913
Michael Valencia
Guest







Re: Placing arrays in ROM, instead of RAM?
PostPosted: Sat Jul 12, 2003 8:06 pm     Reply with quote

I see what I did wrong. For one thing, I didn't read the manual from cover to cover, AND...I didn't put the "const" in the declaration.
Thanks guys.


:=Watto!
:=
:=this...
:=
:=byte const defaults[17]={1,1,1,1,1,37,3,0,0,115,120,29,0,10,0,0,143};
:=
:=...does go into ROM automatically.
:=
:=Regards,
:=Darren
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515916
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