london
Member level 4
problem with #define in c language
I am writing a program in C lang, but now I had a problem on that.
I explain the things bellow,
I have created a headder file & included in my program. That is,
#include "Keys.h"
The details on this headder is,
#ifndef Keys
#define Keys
#define ON_OFF (0x01) //for Meter1&2
#define CAL (0x02) //Only for Meter2
#define HOLD_ENTER (0x04) //Only for Meter2
#define pHCAL_UPARROW (0x08) //for Meter1&2
#define pHHOLD_ENTER_DOWNARROW (0x10) //for Meter1&2
#define MODE_INC (0x20) //for Meter1&2
#endif
I written single program for Meter1&2. so I have define common keys headder file for both. Each keys r doing different jobs except ON_OFF key.
Probleam is,
when I select the Meater1 or Meter2, want to change keys valus also according to that.
For Eg:
If I select Meter1, then CAL, HOLD_ENTER keys can do desiable. And progeam was written to meter1 so no problem.
when i select Meter2, I need to add 2 keys which is desiable above. that is no problem. Another change is pHCAL_UPARROW replaced to CAL and pHHOLD_ENTER_DOWNARROW replaced to HOLD_ENTER.
So tell me the way how to do this? How to handle this problem usins C. Problem is keys r defined in a headder file as constants.
Reply me!!!!
I am writing a program in C lang, but now I had a problem on that.
I explain the things bellow,
I have created a headder file & included in my program. That is,
#include "Keys.h"
The details on this headder is,
#ifndef Keys
#define Keys
#define ON_OFF (0x01) //for Meter1&2
#define CAL (0x02) //Only for Meter2
#define HOLD_ENTER (0x04) //Only for Meter2
#define pHCAL_UPARROW (0x08) //for Meter1&2
#define pHHOLD_ENTER_DOWNARROW (0x10) //for Meter1&2
#define MODE_INC (0x20) //for Meter1&2
#endif
I written single program for Meter1&2. so I have define common keys headder file for both. Each keys r doing different jobs except ON_OFF key.
Probleam is,
when I select the Meater1 or Meter2, want to change keys valus also according to that.
For Eg:
If I select Meter1, then CAL, HOLD_ENTER keys can do desiable. And progeam was written to meter1 so no problem.
when i select Meter2, I need to add 2 keys which is desiable above. that is no problem. Another change is pHCAL_UPARROW replaced to CAL and pHHOLD_ENTER_DOWNARROW replaced to HOLD_ENTER.
So tell me the way how to do this? How to handle this problem usins C. Problem is keys r defined in a headder file as constants.
Reply me!!!!