This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Issue with accessing bit fields bytewise on C2000

Guru 20045 points

Hello,

I want to use the union below to access bit fields bytewise.  However, it doesn't work on the C2000 because an unsigned char is essentially an unsigned int.

Is there a way to make it work?

Stephen

 

typedef union _ABC123

   struct

    {

        unsigned char Low0;

        unsigned char Low1;

        unsigned char High0;

        unsigned char High1;

    } b8;

    struct

    {

        unsigned int b0 : 1;

        unsigned int b0 : 1

        unsigned int b0 : 1;

        unsigned int b0 : 1

        unsigned int b0 : 1

        unsigned int b5 : 1;

        unsigned int b6 : 1;

        unsigned int b7 : 1;

        unsigned int b8 : 1;

        .....

    } b1

} ABC;