Problem with Bitfields in a structure

Hello All,

I am making a bitfiled structure as followed:

typedef struct
{
    uint8_t app1:1;
    uint8_t app2:1;
    uint8_t app3:1;
    uint8_t app4:1;
    uint8_t app5:1;
    uint8_t app6:1;
    uint8_t app7:1;
    uint8_t app8:1;


}STATUS_TYPE;

in my program I am accessing a bit and trying to ex-or it (status.app1^=1;), but while doing the bit operation, other bits are also changing (as i am observing from debug window). I have no idea why it is happening, i am a complete beginner.

I tried __attribute__((packed)) struct and __PACKED_STRUCT as well, but the same result. Please help.

IDE Info:

Hardware:

NUCLEO-F411RE having STM32F411RE controller, and i am using On-board STlinkV2 for debugging.

Parents Reply Children
No data