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.
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
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- A talented person actually analyzed power MOS like this, it is very rare information!
- MicroPython has made several adjustments to USB functions
- Commonly used algorithms for drones - Kalman filter (IV)
- Why does Apple use UWB technology? Learn more about UWB here
- How to use LOTO oscilloscope to draw frequency response characteristic curve?
- About the use of memory AT45DB041
- Be the first to experience the Mir MYS-8MMX embedded single board computer for free!
- The waveform of the zero line at the input end of the three-phase uncontrolled rectifier to the negative pole of the output voltage
- I have a small question for everyone.
- Smart water meter