Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Solve my problem in C language!!!

Status
Not open for further replies.

london

Member level 4
Joined
Jun 30, 2006
Messages
79
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,945
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!!!!
 

Hello Friend

Sorry I am really not able to spot your problem.
Please explain with more details.

Regards
Gopi
 

you can also have condition branch in header file macro
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top