开发者

Why does some sfr in 8051 are bit addressable?

According to this: http://www.8052.com/tutsfr.php , the sfrs whose address are divisible by 8 are bit addressable. You can do things like SETB or CLR on them. But aren't they 开发者_如何学Coverlap other memory addresses? I mean, for example, P0 is in 80h. So P0.0 will be 80h, P0.1 will be 81h. But 81h is the address of SP. Aren't they overlap?


You are confusing a bit address with a byte address. They do not overlap or refer to the same physical location. Instructions that take bit addresses (eg. SETB) know how to decode the bit address into a byte address and bit number. The byte address is obtained by masking out the 3 lowest bits in the bit address. The bit number is obtained by masking out the highest 5 bits.

eg. bit address 87h --> byte address 80h, bit #7


P0.0 and P0.1 only refers to individual bits of the 8-bit P0 register (from what I understand).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜