#define eeprom value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-15 10:23 AM
Hello,
I have settings in my EEPROM. I would like to assign these parameters with a #define.
I tried several things, searched the internet, but couldn't find anything conclusive.
I found something, but it is not suitable for my program, here it is :
#define a ((uint16_t*) ((uint32_t) 0x08080000))
It works this way :
if(*a == 1)
{
.....
}
But it doesn't work that way which fits my program :
#if( *a == 1)
.....
#endif
Do you know the right way to do it ? Thank you
- Labels:
-
EEPROM devices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-15 11:00 AM
Top method computes at runtime, the lower the compiler's pre-processor, at compile time. How would that possibly work?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-16 12:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-16 12:54 AM
Thanks a lot for your answers.
Since I didn't want to change a big part of my program, I hoped to find a miracle solution. I thought it wasn't possible, but I hoped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-16 01:14 AM
Steve Steve, your code isnt real. DEFINE is constant, then you cant ask for memory value.
You only for your example can have two defines, one for adr second for value.
#define ADDRa ((uint16_t*) ((uint32_t) 0x08080000))
#define VALUEa 1
then you can use in code
*ADDRa = VALUEa;
...
#if VALUEa == 1
#endif
For some eeprom too first line dont work and need function call for write or read...