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

struct definition problem

Hi,

I'm using KEIL uVision2 V2.20a, This definition doesn't work, anyone know why ?

Usually I'm using this to access each bit separatly in a byte, rather than using shifting ans masking. In my MPLAB C its working fine. But when using this declaration in KEIL I get the error:

ERROR C150 'b0' bit member in struct/union

My struct definition is:

struct structSplitByte
{
bit b0;
bit b1;
bit b2;
bit b3;
bit b4;
bit b5;
bit b6;
bit b7;
};

union unionSplit
{
struct structSplitByte Split;
char cValue;
};



Or does anyone know a better and easy way to access the value of one bit in a byte ?

Thank you,

Aldrin,

Parents
  • "...is potentially difficult to port as C does not specify the order of the bit fields in memory"

    and has its own difficulties in C51, as Keil's implementation can be somewhat unexpected!

    Search the knowledgebase (and this forum) as there are articles on the common pitfalls!

    Another reason to stick with the masks...?

Reply
  • "...is potentially difficult to port as C does not specify the order of the bit fields in memory"

    and has its own difficulties in C51, as Keil's implementation can be somewhat unexpected!

    Search the knowledgebase (and this forum) as there are articles on the common pitfalls!

    Another reason to stick with the masks...?

Children
No data