|
|
View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
preprocessor command as CBLOCK in assembler |
Posted: Wed Apr 12, 2006 2:51 am |
|
|
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
|
|
Posted: Wed Apr 12, 2006 4:51 am |
|
|
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
|
|
Posted: Wed Apr 12, 2006 5:24 am |
|
|
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
|
|
Posted: Wed Apr 12, 2006 6:46 am |
|
|
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 |
|
|
|
|
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
|