Hello,
If a bdata variable is defined in the form:
struct foo { unsigned char b1:1; unsigned char b2:1; unsigned char b3:1; unsigned char b4:1; unsigned char b5:1; unsigned char b6:1; unsigned char b7:1; unsigned char b8:1; } bdata myflags;
Will the code:
if (myflags.b3) // do something
or the code:
myflags.b5 = 1;
generate the efficient 8051 code using jb, setb, etc?
I will do some testing myself, but in the meantime I'd like to know your ideas and advices.
I am porting some C code to Keil C51 and I am wondering if I can avoid the use of the bit and sbit keywords which are heavy extensions to C.
Thanks, Nestor
If the object is in bdata, then the most efficient way to access it is to use the bit-addressing features of the 8051 - not a 'C' bitfield.
Thanks for your quick answer.
Nestor.