Keil Logo Arm Logo

Discussion Forum

Changing #define

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Abhijeet Mudgal
Posted
20-Feb-2009 09:41 GMT
Toolset
C51
New! Changing #define

Hello,

In programme I have defined

#define DEVICE_ID 0x32

But I want to change Device Id when I get command of change Device Address.

How should I do it?

Regards,
Abhijeet R. Mudgal.

Read-Only
Author
Andy Neil
Posted
20-Feb-2009 10:03 GMT
Toolset
None
New! Textbook time

This is standard, textbook 'C' - nothing specifically to do with the 8051 or Keil.

#define gives a definition that is fixed at compile time;

IF you want it to be changeable at run time, you will need to use a variable.

Read-Only
Author
aamir khan
Posted
20-Feb-2009 10:08 GMT
Toolset
C51
New! RE: Changing #define

u cant do it like that
coz DEVICE_ID is replaced by 0x32 where ever u hve written it by compiler
if u wana assign DEVICE_ID different Values that declear it as variable in user program
not in this way

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.