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

preprocessor command as CBLOCK in assembler

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



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

preprocessor command as CBLOCK in assembler
PostPosted: Wed Apr 12, 2006 2:51 am     Reply with quote

Hi everybody,

I need to define a block string as constant.
In assembler I used CBLOCK to define a block of location as follow:
Quote:

CBLOCK D'100'
one
two
three
four
ENDC


so:
one=100
two=101
three=102
four=104

I don't want use #define 200 times, is there any prerocessor command as CBLOCK ?

Thanks for support,
Ttelmah
Guest







PostPosted: Wed Apr 12, 2006 4:51 am     Reply with quote

Nothing quite the same in terms of a 'named' list. Remember though, that #ROM, will allow you to place data of any type at a location, so a structure with named elements can be placed where you want. However in general, in C, you wouldn't bother. Why would you need to put something at a spcific location?. In general, much easier just to declare a const structure or array, and let the compiler put it where it wants.
#Defines,won't do this at all (they are only preprocessor commands, and do not actually store anything).

Best Wishes
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Wed Apr 12, 2006 5:24 am     Reply with quote

Hi Ttelmah,

I have to define some eeprom location where read and write specific data.

In my project there is over 200 eeprom location.

Actually i use #define, have you got any idea ?

Thanks,
Ttelmah
Guest







PostPosted: Wed Apr 12, 2006 6:46 am     Reply with quote

I suppose you mean that you 'define' a symbolic 'name' for the location, to give it 'significance', and then access this with the read_eeprom function?.
This would be 'distinct' from what can be done using a structure defined 'at' a memory location (which would include the retrieval code).

You can do this with the C 'enum'.
So:

enum EEPROM_LOCN {one=100,two,three,four,five };

etc..

Best Wishes
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