【问题标题】:Byte and Bit addressable 8051字节和位可寻址 8051
【发布时间】:2018-02-16 12:24:54
【问题描述】:

8051 SFR

'P0,SP, DPL & DPH' 的字节地址为80h,81h,82h,83h。由于P0 是可位寻址的,所以P0.0 - P0.7 具有位地址80h - 87h。但是,它如何区分地址P0.1(81h) & SP(81h), P0.2(82h) & DPL(82h), P0.3(83h) & DPH(83h) ...?

【问题讨论】:

    标签: microcontroller 8051


    【解决方案1】:

    字节地址和位地址永远不会在同一条指令中使用。 所以虽然

    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 需要进行不同的编码,而处理器实际上并不关心它们是如何编写的,因为它根本看不到源代码。

    【讨论】:

      猜你喜欢
      • 2011-02-13
      • 2019-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多