文档详情

第四章 MCS5 单片机的指令系统 8242.ppt

发布:2017-05-26约1.36万字共46页下载文档
文本预览下载声明
All of the logical instructions that are Accumulator specific execute in 1μs (using a 12 MHz clock). The others take 2μs Boolean operations can be performed on any byte in the lower 128 internal Data Memory space or the SFR space using direct addressing, without having to use the Accumulator. For example, ① If the Accumulator contains and byte contains, then ANL A, byte will leave the Accumulator holding ② The SWAP A instruction is a useful operation in BCD manipulations. If the Accumulator contains a binary number which is known to be less than 100, it can be quickly converted to BCD by the following code: MOV B, #10 DIV AB SWAP A ADD A, B ③ 编程模拟组合逻辑电路的功能 ④在程序设计中,人们常用“与”方法清某一单元的一个字节或某一字节的若干位,称为“屏蔽”。设(A), 现欲屏蔽其高4位,则可用如下指令: ANL A, #0FH 结果为(A)=05H, 高4位全为0, 低4位不变。 X Y Z F X · Y + Y Z = F 程序:MOV A, X ANL A, Y MOV R1, A MOV A, Y XRL A, Z CPL A ORL A, R1 MOV F, A * 第四章 MCS-51 单片机的指令系统 * 要求:①掌握指令功能, ②指令执行后对标志的影响, ③指令的字节数及执行时间, ④不编造不存在的指令 4.1 指令和指令程序 1. 指令和助记符 机器指令 ? 助记符 ? 汇编源程序 全部指令的集合称为指令系统,共111条指令。 指令的组成 由两部分组成:操作码和操作数 可分为:单字节、双字节、三字节指令 3. 指令系统中的符号说明 (1)指令助记符中的符号 Rn: 内部工作寄存器R0~R7 Ri: R0或R1,用于间接寻址(作指针用) #data: 表示立即数,例如:#59H,#74H等 direct: 表示直接地址,例如:59H,74H等 addr16: 表示16位的目的地址,用于LCALL, LJMP指令 addr11: 表示11位的目的地址,用于ACALL, AJMP指令 rel : 表示一个8位的偏移量 DPTR: 表示数据指针 bit: 内部RAM或专用寄存器中直接寻址的位地址 @: 间接寄存器或基址寄存器前缀 (2)有关注释 (A)? (Rn)或 A? Rn (直接地址)? ((Ri))或 直接地址 ? (Ri) ∧: 逻辑与 ∨: 逻辑或 ∨:逻辑异或 4.2 Addressing Modes 1. Direct Addressing (直接寻址) The operand is specified by an 8-bit address field in the instruction. for example: MOV A , 3AH ; (A) ? (3AH) Only internal Data RAM
显示全部
相似文档