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

Access to Bit Struct Member in "Extendet Inline Assembler"

How can i access to a bit which is a member of a C Struct in the "Extendet inline Asembler"

I tried various versions like below, but the compiler only generates Error messages

struct
{
    unsigned b0 : 1;
    unsigned b1 : 1;
    unsigned b2 : 1;
    unsigned b3 : 1;
    unsigned b4 : 1;
    unsigned b5 : 1;
}bdata _bits_;

..
..
..

__asm
{
    JNB _bits_.b3, test_label
    ..
    ..
    test_label:
}

Parents
  • How about this:

    union {
        int word;
        struct
        {
            unsigned b0 : 1;
            unsigned b1 : 1;
            unsigned b2 : 1;
            unsigned b3 : 1;
            unsigned b4 : 1;
            unsigned b5 : 1;
        } bits;
    } bdata var;
    
    sbit mybit = var.word ^ 3;
    
    void main(void)
    {
        __asm {
    	    JNB mybit, label
        label:
        }
    }
    

    Ugly, but works.

    - mike

Reply
  • How about this:

    union {
        int word;
        struct
        {
            unsigned b0 : 1;
            unsigned b1 : 1;
            unsigned b2 : 1;
            unsigned b3 : 1;
            unsigned b4 : 1;
            unsigned b5 : 1;
        } bits;
    } bdata var;
    
    sbit mybit = var.word ^ 3;
    
    void main(void)
    {
        __asm {
    	    JNB mybit, label
        label:
        }
    }
    

    Ugly, but works.

    - mike

Children