#define is compile-time. you can't use them in if statements for runtime.
Thanks,
_|_|_|_|_| _| _|_|_|_|
_| _|_|_| _| _|_|_|
_| _| _| _|_|_| _|
_| _| _| _| _|
_| _| _| _|_|_|_| _|_|_|
Visit TDS for quality software and website production
http://tysdomain.com
msn: [EMAIL PROTECTED]
aim: st8amnd2005
skype: st8amnd127
----- Original Message -----
From: bscottkelley
To: [email protected]
Sent: Friday, September 26, 2008 4:09 PM
Subject: [c-prog] How to make a #define dependent upon eeprom data?
I have a number of #define commands in my current code. I now need
to provide for two or more possible definitions, depending upon the
value of a particular eeprom byte.
For example,
if eeprom byte #0x22 =0, define "Hysteresis" as 15
if eeprom byte #0x22 =1, define "Hysteresis" as 11
It seems to me that I have seen a one line function that would work
for this where the "selection byte" would indicate a location in a
following list of numbers, something kinda like this:
temp = I2C_EEPROM_read(0x00, 0x22);
#define Hysteresis (temp: 15,11,9)
Sorry if this is a 'no-brainer', but I'm really rusty & I'm just not
coming up with anything in my C books...
Thx
Scott Kelley
__________ NOD32 3475 (20080926) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]