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

Compiler's Bug or an unexpected convention ? Bit addressing on an INT variable

I declared an int variable in bdata memory and want to access the individual bits in it, but the address of bit looks wrong. The declaration part is like this,

int bdata Flags;
sbit F_0 = Flags ^ 0;
When I was making the declaration, I expected that F_0 is the lowest bit of Flags, that is, when I set F_0 to 1, the result shall be the same as
Flags |= 1;

But when I tested the code like this,
Flags = 0;
F_0 = 1;
the result is that Flags == 0x0100, not the expected 0x0001.

It looks that Keil compiler uses LSB for int variable allocation sometimes while it uses MSB mostly.