MCS-51 single-chip computer instruction system shorthand

Publisher:PeacefulOasisLatest update time:2016-09-05 Source: eefocusKeywords:MCS-51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Assembly language instructions consist of two parts: opcode and operand. MCS-51 uses assembly language instructions, with a total of 111 instructions, 44 opcode mnemonics, and 33 functions. Its operand forms include "#data, direct, Rn, @Ri", etc.

1. How to memorize mnemonics

1. Table enumeration method

The 44 instruction mnemonics are divided into five categories according to their functions, and each category is memorized in a list.

2. English Restoration Method

The operation code mnemonics of the microcontroller are the English abbreviations of the instruction functions. Converting the abbreviations into the original English text and comparing them with the Chinese text will help you understand the meaning of the mnemonics and thus strengthen your memory. For example:

INC-Incremect DNC-Decrement

Short jump SJMP - Short jump Long jump LJMP - Long jump

Compare jump not equality 

AJMP-Absolute jump NOP-No operation

Exchange XCH-Exchange Addition ADD-Addition

Multiplication MUL-Multiplication Division DIV-Division

RL-Rotate left RLC-Rotate left carry

RR-Rotate right carry RRC-Rotate right carry

3. Functional module memory method

The 44 instruction mnemonics of the microcontroller can be divided into five categories according to their instruction functions, and each category can be divided into 2 to 3 groups based on the principle of similar functions.  

1) Data transfer group. 2) Addition and subtraction operation group

  MOV internal data transfer ADD addition

  MOVC Program memory transfer ADDC Add with carry

  MOVX External data transfer SUBB Subtraction with carry

3) Logical operation group. 4) Subroutine call group.

  ANL logic and LCALL long call

  ORL logical or ALALL absolute call

  XRL Logical exclusive OR RET Subroutine return

2. How to memorize instructions

1. Symbols of instruction operands

There are six addressing modes of MCS-51: immediate addressing, direct addressing, register addressing, inter-register addressing, indexed addressing, and relative addressing.

1) Immediate value and direct address. ata indicates an eight-bit immediate value, #data16 indicates a sixteen-bit immediate value, and data or direct indicates a direct address.

2) Rn (n=0-7), A, B, CY, DPTR register addressing variables.

3) @R0, @R1, @DPTR, SP represent register address variables.

4) DPTR+A, PC+A represent variables with displacement addressing.

5) PC + rel (relative quantity) indicates a relative addressing variable.

Remembering the mnemonics of instructions and mastering the representation of instruction operands in different addressing modes lays the foundation for us to memorize assembly instructions. Although there are many MCS-51 instructions, they can be divided into five categories according to their functions, including 28 data transfer instructions, 24 arithmetic operations, 25 logical operations, 17 control transfers, and 17 Boolean bit operations. In each category of instructions, according to its function, grasp the different combinations of its source and destination operands, and then use the following methods to remember them.

It is agreed that possible destination operands are represented in the order (# data/direct/A/Rn/@Ri ).

For MOV instructions, the destination operand is written in the order of A, Rn, direct, @Ri, and you can remember the 15 MOV instructions. For example, with accumulator A as the destination operand, you can write the following 4 instructions.

  MOV A, #data/direct/A/Rn/@Ri

  And so on, write other instructions.

  MOV Rn,#data/direct/A

  MOV direct, #data/direct/A/Rn/@Ri

  MOV @Ri,#data/direct/A

2. Instruction graphic memory method

The graphic mnemonic method is a mnemonic method that uses graphics and arrows to represent the relationship between the destination and source operands of instructions with the same or similar operating functions but different operands. For example, the instruction to send an array composed of the mnemonics MOV, MOVX, and MOVC can be memorized using Figures 1 and 2.

The four instructions formed by the mnemonic CJNE can also be represented graphically, as shown in Figure 3.

CJNE A,#data,rel CJNE A,direct,rel

CJNE @Rn, #data, rel CJNE @Ri, #data, rel

In addition, for the 18 logical operation instructions formed by (ANL, ORL, ARL), the four ring shift instructions related to A can also be represented by diagrams. Readers are requested to draw them and memorize them by themselves.

3. Classification of similar functions

In the MCS-51 instructions, we found that some instructions have different opcodes, but similar functions and the same operands. The similar function classification method is to memorize instructions with such characteristics together. As long as you remember one of them, you can remember the rest. For example, there are twelve instructions for addition and subtraction, and eighteen instructions for AND, OR, and NOT, which are listed below.

  ADD/ADDC/SUBB A, #data/direct/Rn/@Ri

  ANL/ORL/XRL A, #data/direct/Rn/@Ri

  ANL/ORL/XRL direct, #data/a

  Each row of instructions above has similar functions and the same operands. Other instructions such as addition (INC) and subtraction (DEC) can also be handled in the same way. 

Keywords:MCS-51 Reference address:MCS-51 single-chip computer instruction system shorthand

Previous article:Two methods of MCU output PWM pulse
Next article:A Design of USB Download Cable for AT89S52

Recommended ReadingLatest update time:2024-11-16 13:44

Introduction to 8051 core, MCS-51 compatible 1T instruction system, and general IO type 8-bit chip CMS8S5897
Overview: The CMCMS8S589x series is an 8-bit chip with an 8051 core, a 1T instruction system compatible with MCS-51, and a general-purpose IO type. The operating frequency can reach up to 48MHz, the voltage is 2.1V-5.5V, and the GPIO can reach up to 30. It supports internal and external clock. The CMS8S589x series MCU
[Microcontroller]
Introduction to 8051 core, MCS-51 compatible 1T instruction system, and general IO type 8-bit chip CMS8S5897
Serial port and serial communication technology of MCS-51 single chip microcomputer
Basic concepts of data communication There are three types of serial communication: simplex communication, half-duplex communication and full-duplex communication. Simplex communication: Data can only be transmitted in one direction from one end to the other. For example, current cable TV programs can only be transmit
[Microcontroller]
Serial port and serial communication technology of MCS-51 single chip microcomputer
Chapter 5 Timer/Counter
Timer/Counter Function There are two programmable timer/counters T0 and T1 in the MCS-51 microcontroller. They are both 16-bit adder counters, consisting of four 8-bit counters TH0, TL0 and TH1, TL1, respectively. Each timer/counter has both timing and counting functions. Counting function Count
[Microcontroller]
What is the use of the program status register PSW of the MCS-51 microcontroller?
PSW is an 8-bit register used to set the CPU status and indicate the status after instruction execution. CY (PSW.7): ​​Carry flag. When executing addition or subtraction instructions, if the highest bit (D7) of the operation result has a carry or borrow, CY is automatically set to 1 by hardware. AC (PSW.6): Half c
[Microcontroller]
What is the use of the program status register PSW of the MCS-51 microcontroller?
MCS-51 MCU Practical Subroutine Library--Floating Point Division
Label: FDIV Function: Floating point division Entry condition: dividend is in , divisor is in . Exit information: when OV=0, quotient is still in , when OV=1, overflow. Affected resources: PSW, A, B, R2~R7, bits 1EH, 1FH Stack requirement: 5 bytes FDIV: INC R0 MOV A,@R0 INC R0 ORL A,@R0 DEC R0 DEC R0 JNZ DIV1
[Microcontroller]
MCS-51 series microcontroller bit control transfer instructions (5)
Boolean processing is an important feature of the MCS-51 series of microcontrollers, which is set up for practical application needs. Boolean variables are also switch variables, which are operated in bits. In terms of physical structure, the MCS-51 microcontroller has a Boolean processor that uses the carry flag as
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号