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

bug of define a bit in bdata

C:
bdata unsigned BUFR16=0;
sbit BIT8=BUFR16^8;

the assemble language which is compiled by Keil uVision3:
C:0x1172 9210 MOV BIT8(0x22.0),C
......
;BUFR16<<=1;
C:0x117D E522 MOV A,0x22
C:0x117F 25E0 ADD A,ACC(0xE0)
C:0x1181 F522 MOV 0x22,A
C:0x1183 E521 MOV A,BUFR16(0x21)
C:0x1185 33 RLC A
C:0x1186 F521 MOV BUFR16(0x21),A
......

Parents Reply Children
  • Yes, it's always confusing when the same platform uses different big- and little- endian numbering for the bytes and bits.

    The 8051 bit addresses start at the LSB of location 20H, increment to the MSB of location 20H, and then to the LSB of location 21H. Bit 8 is the LSB of 21H. Bit 7F is the MSB of location 2FH.