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

Compiler change

Why does declaring a bit within a function like this not work?

void function()
{
data bit pushbutton_dn = (dwrxbuf[3] == PB_DN);
}

This results in the pushbutton_dn getting assigned to 0x0E.1
The list file places the results of this operation in 0x25.5

Any help?

Parents
  • Maybe the problem is with the 'data' declaration. Since the bit type is going to be placed in data space, perhaps the latest compiler gets confused.

    You might also consider using:

    #define BIT bit

    this allows you to port your code between different compilers without rewrite. As an example, in a target for an X86 -
    #define BIT

    would compile the code properly. You could also make version specific:

    #if __C51__ == 5
    #define BIT data bit
    #endif
    #if __C51__ == 6
    #define BIT bit
    #endif

    in case you need to compile with either.

Reply
  • Maybe the problem is with the 'data' declaration. Since the bit type is going to be placed in data space, perhaps the latest compiler gets confused.

    You might also consider using:

    #define BIT bit

    this allows you to port your code between different compilers without rewrite. As an example, in a target for an X86 -
    #define BIT

    would compile the code properly. You could also make version specific:

    #if __C51__ == 5
    #define BIT data bit
    #endif
    #if __C51__ == 6
    #define BIT bit
    #endif

    in case you need to compile with either.

Children
No data