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
  • >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:

    As said by others, the "bit" directive is compiler specific.

    PIC processors can manipulate bits in every register, so naturally the PIC compiler allows you to define bit variables anywhere in memory.

Reply
  • >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:

    As said by others, the "bit" directive is compiler specific.

    PIC processors can manipulate bits in every register, so naturally the PIC compiler allows you to define bit variables anywhere in memory.

Children
No data