David Hamill wrote:
> As the others say, you probably want to do it at run time,
> not compile time.
>
> But if you *do* want to do it at compile time, you could do
> something like this:
>
> /* File test.c */
>
> #include <stdio.h>
>
> /* Error value: */
> #define HYSTERESIS -1
>
> #ifdef EEPROM_0
> #define HYSTERESIS 11
> #endif
>
> #ifdef EEPROM_1
> #define HYSTERESIS 15
> #endif
>
>
> int main(void)
> {
> if (HYSTERESIS == -1)
> puts("You need to #define either EEPROM_0 or
> EEPROM_1");
> else
> printf("hysteresis=%i\n", HYSTERESIS);
>
> return 0;
> }
Not sure why you are doing that.
#if defined(EEPROM_0)
#define HYSTERESIS 11
#elif defined(EEPROM_1)
#define HYSTERESIS 15
#else
#error "You must define either EEPROM_0 or EEPROM_1"
#endif
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/