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

Putting bytes in rom in an easy human readable fashion

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



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Putting bytes in rom in an easy human readable fashion
PostPosted: Fri Oct 21, 2005 9:31 am     Reply with quote

Hi

I want to store data, such as IP addresses at a fixed location in program memory that is both in a human readable fashion and memory efficient.

In MPASM I would do this:
Code:

MIP   DB   230, 10, 10, 11   ; IP address 230.10.10.11


But DB is not supported by the CCS assembler.

I know I can do this in CCS but it is unreadable:
Code:

#rom MIP       = {230 | (10 <<8), 10 | (11 <<8)} // 230.10.10.11


Ideas welcome...
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Fri Oct 21, 2005 9:36 am     Reply with quote

It seems that MIP is a 2 16 bit variables. Why not 4 bytes?
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Oct 21, 2005 9:39 am     Reply with quote

Quote:
It seems that MIP is a 2 16 bit variables. Why not 4 bytes?


Because then the compiler consumes 8 bytes of rom space.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 21, 2005 9:43 am     Reply with quote

You can use "#rom int8 address =" to store packed bytes. Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=21184
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Oct 21, 2005 9:46 am     Reply with quote

PCM programmer wrote:
You can use "#rom int8 address =" to store packed bytes. Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=21184


Thanks - much more readable. I searched old posts but obviously missed it.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
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