This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to revalue a symbol in C51?

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.


Parents Reply Children
  • 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!