51 MCU instruction system addressing mode

Publisher:精品古钱斋Latest update time:2021-03-01 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The way instructions give data to be operated is called addressing mode. In other words, addressing mode is to find the real address of the number involved in the operation.


There are 7 addressing modes in the instruction system of the MCS-51 series microcontrollers.


Immediate addressing mode is an addressing mode of the MCS-51 microcontroller. The operand is written in the instruction and placed in the program memory together with the opcode. Put the "#" sign in front of the immediate number to indicate that the addressing mode is immediate addressing, such as #20H. The immediate addressing mode is usually used to assign initial values ​​to general registers or memory units.

In direct addressing mode, the operand field of the instruction gives the address of the operand participating in the operation. In the MCS-51 microcontroller, direct addresses can only be used to represent special function registers, internal data registers and bit address space. Among them, special function registers and bit address space can only be accessed using direct addressing mode.


Register addressing mode, the operand is in the register. The value of the three bits rrr in the instruction opcode and the status of RS1 and RS0 in PSW select a register in a certain working register area, and then perform the corresponding instruction operation. The operand required by the instruction is already stored in a register, or the target operand is stored in the register. The addressing mode that indicates the register to be used (i.e., the register mnemonic) in the instruction is called register addressing mode.


In indirect addressing mode, the instruction operand gives the register that stores the operand address. In the MCS-51 instruction system, the registers that can be used for register indirect addressing include working registers R0~R1, stack indicator SP and address register DPTR. In the instruction mnemonic, indirect addressing is represented by the symbol @.


The relative addressing mode uses the content of the current program counter pc as the base address and adds the one-byte complement number (offset) given by the instruction to form a new pc value.


Displacement addressing mode, among general registers, some registers can be used as displacement registers. Taking the sum of the content of the displacement register (usually the first address) and the address given by the instruction address code (usually the displacement) as the address of the operand to obtain the required operand is called displacement addressing.


Bit addressing mode refers to the addressing of some internal data storage RAM and special function registers when performing bit operations. When performing bit operations, the carry bit C is used as the operation accumulator, the instruction operand field directly gives the address of the bit, and then the bit is operated according to the nature of the operation code. The bit address is exactly the same as the byte address in byte direct addressing, and is mainly distinguished by the operation code.


Reference address:51 MCU instruction system addressing mode

Previous article:Working principle and usage of 51 single chip microcomputer timer
Next article:Summary of the 51 MCU learning MCU

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号