1. How to memorize mnemonics
1 Tabular enumeration method
The 44 instruction mnemonics are divided into five categories according to their functions, and each category is memorized in a list. I will omit them here and ask the reader to summarize them by himself.
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:
Increment INC-Incremect Decrement DNC-Decrement Short jump SJMP-Short jump Long jump LJMP-Long jump Compare jump CJNE-Compare jump not equality Absolute jump AJMP-Absolute jump No operation NOP-No operation Exchange XCH-Exchange Addition ADD-Addition Multiplication MUL-Multiplication Division DIV-Division Rotate left RL-Rotate left carry 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 according to the principle of similar functions. In this way, the whole can be broken down into parts, and each can be defeated one by one to achieve rapid memorization.
1) Data transmission group
2) Addition and subtraction operation group: MOV internal data transfer ADD addition MOVC program memory transfer ADDC with carry addition MOVX external data transfer SUBB with carry subtraction
3) Logical operation group
4) Subroutine call group: ANL logical AND LCALL long call ORL logical OR ALALL absolute call XRL logical exclusive OR RET subroutine return
2. How to memorize instructions
1 Symbols related to instruction operands
There are six addressing modes in MCS-51: immediate addressing, direct addressing, register addressing, inter-register addressing, indexed addressing, and relative addressing. We must master their representation methods.
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 methods 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 transfer instructions, 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 it. We agree that the possible destination operands are represented in the order of (#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 by a diagram, 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.
4. Mnemonics
For some instructions, we can use concise language to compile the related functions into a sentence to memorize. For example, the two instructions PUSH direct and POP direct. Beginners often cannot distinguish the changes in the stack SP, so we compile a sentence like this: (the content of SP) plus 1 (the content of direct) and then push it into the stack, (the content of SP) is popped (to the direct unit) SP is then reduced by 1. For example, the storage of the product in the multiplication instruction, the storage of the dividend, divisor and quotient in the division instruction, can all be compiled into a mnemonic to memorize as follows: MUL AB
The high-order product is stored in B, and the low-order product is stored in A.
DIV AB
When A is divided by B, the quotient is stored in A and the remainder is B.
The above introduces several methods of quickly memorizing microcontroller instructions. I hope it can serve as a starting point for discussion. I believe that readers can find a method that suits them in the process of learning microcontrollers. However, having a good method is not enough. Practice is also needed. That is, read more examples in books and programs written by others, and then write some programs yourself based on actual practice. Only in this way can you master the microcontroller instruction system better and faster.
Expert advice
When you first start learning microcontrollers, you must understand some digital circuits. If you are not familiar with the general concepts of digital circuits, it is best to take some extra lessons before learning microcontrollers. Next, you'd better choose a type of microcontroller to learn, because there are many types of microcontrollers at present, and their structures and instructions are different. If you learn one for two days and another for two days, you will often not be able to digest it. It is recommended that you first learn 8051 microcontrollers, because there are many books, materials, and equipment related to 8051. Although PIC, AVR and other types of microcontrollers have their advantages, the current supply of books, materials and devices is not ideal, and they are not suitable for beginners. If you don't care about these, it is not a bad idea to choose the latter to learn.
The reason why we recommend that you choose 8051 microcontroller to start learning is that there are many derivatives of the 8051 family. For example, ATMEL's AT89C51 series microcontrollers are fully compatible with the MSC-51 8051 series (that is, the AT89C51's instructions, pins, internal main structure, and usage are the same as the MSC-51). Not only is it compatible, but it also has many innovations. For example, its program memory can be electrically erased and written. A single IC has the smallest system of a single-chip microcomputer in the past, and there is no need for the so-called 373 and EPROM components in the past. Therefore, it is relatively easy to connect circuits and make circuit boards during experiments. In addition, its price is relatively low at present. The chips you study can also be used to make products, and the chips used to make products can also be used for experiments. Of course, the AVR series also has these characteristics; PIC and other series are not ideal in this regard.
Previous article:MCU interface principle circuit diagram
Next article:8051 MCU pin diagram and pin functions
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Study on frequency requirements for 5G NR-V2X direct communication
- Solution to SensorTile.box not finding serial port using Unicleo-GUI
- The express delivery didn’t arrive for 6 days. I took a look and found out that the express delivery also misses home.
- [GD32L233C-START Review] - Transplanting Freertos real-time system
- [Warehouse temperature and humidity automatic control simulation system] 3. RSL10 BLE Mesh networking first experience
- DSP 2812: GPIO encapsulation using C++
- Compound op amp amplification problem
- The DC power supply output voltage is unstable. How to calibrate and test it?
- [National Technology N32G457 Review] 11 N32G45 and STM32 CAN Communication Example
- PCB drawing board suggestions for B628 lithium battery boost circuit chip