字节和位可寻址8051

时间:2018-02-16 12:24:55

标签: microcontroller 8051

8051 SFR

Factory myFact = new ConcreteFact1; // (2) Product myProd = myFact.createProd(); // (1) myProd.doSomething(); // (1) 的字节地址为'P0,SP, DPL & DPH'。由于80h,81h,82h,83h位可寻址,P0位地址为P0.0 - P0.7。但是,它如何区分地址80h - 87h ......?

1 个答案:

答案 0 :(得分:0)

字节地址和位地址从不在同一指令中使用。 所以,而

mov SP, #5    ; mov 81h, #5
mov P0.1, C     ; setb 81h

都有地址81h,两者都写为mov,第一个汇编为0x75 0x81 0x5,第二个汇编为0x91 0x81。对于处理器,0x75和0x91意味着完全不同的东西,即move the the value in the 3rd byte of this instruction to the address in the second byte of this instructionmove the carry flag to the bit address in the second byte of this instruction。汇编程序知道mov addr, #immmov bit, C需要以不同的方式编码,并且处理器实际上并不关心它们是如何编写的,因为它根本看不到源代码。

相关问题