Hi: How are you? We can use "SET" directive in A51 to revalue a symbol such as: ... x SET 1 ... x SET 2 ... And how can I revalue a symbol in C51? I want to use "#define" but no way. Please help me.
"One question is why does this need to be done in the preprocessor?" Yes - that's the point I was trying to make earlier. We need David to explain what it is that he's actually trying to achieve
Thanks for your help! Now I get it, Davis' STRUCT and OFFSETOF is what I want. I am trying to define serial addresses in my EEPRom so I can visit these addresses in my routine. And each of address contains a number of bytes, such as MyAddr0 contains 1 byte,MyAddr1 contains 2 bytes, MyAddr2 contains 3 bytes... I can define these addresses using "#define" /*********start define******************************/ #define MyAddr0 0x00 //MyAddr0 start form 0x00 and use 1 byte #define MyAddr1 0X01 //MyAddr1 start form 0x01 and use 2 bytes(0x01 and 0x02) #define MyAddr2 0X03 //MyAddr2 start form 0x03 and use 3 bytes(0x03 to 0x05) /* ....... */ //now MyAddr3 must start form 0x06 /*********end define*******************************/ It will bother me when there are many addresses, but if I write A51 program, I can use "Dim" MACRO list up to "EQU" these address and "SET" the start address to the first no-use byte in EEPRom. "Dim" MACRO is easy use :) Now I can use Davis' STRUCT and OFFSETOF to do this easily, thank you!