With the development of microelectronics and oversized integrated circuit technology, single-chip microcomputers are characterized in various fields (such as industrial control, household appliances, automotive electronics) in various fields (such as industrial control, household appliances, automotive electronics) in various fields (such as industrial control, home appliances, automotive electronics) in various fields (such as industrial control, household appliances, automotive electronics "in various fields (such as industrial control, household appliances, automotive electronics" in various fields (such as industrial control, household appliances, automotive electronics "in various fields (such as industrial control, household appliances, automotive electronics) with small size, high cost performance, high function, high reliability , Communication, intelligent instrumentation, has been widely used. Learning, there are more and more people using the microcontroller, and there are many manufacturers of the production of the microcontroller, and the type of single chip microcomputer is complicated. I don't know how to choose. According to statistics, the eight single-chip machine accounted for 65% of the global single-chip sales. In the eight single-chip microcomputer, Intel's 8051 single-chip core has become an actual standard for 8 single-chip microcomputer. Therefore, for beginners, the 8051 single-chip microcomputer is selected to learn from wise choices.
To learn a single-chip microcomputer, in addition to the internal function of the microcontroller, storage space allocation and I / O interface, you should also grasp the instruction system. The MCS-51 has a total of 111 instructions, which is now introduced in the summary of the fast memory MCS-51 instruction for your reference.
Everyone knows that the assembly language instruction consists of an operation code, an operand. The MCS-51 uses assembly language instructions, which has a total of 44 operating code help, 33 functions, with # data, direct, rn, @ ri, etc. Here, you will first introduce the memory method of the instructions and their related symbols.
I. Memory method for helping the symbol
1 Table list
Divide 44 instructions to five categories according to functions, and each class is memorized. Here, please summarize yourself.
2 English restore method
The operating code help of the single chip microcomputer is the English abbreviation of the instruction function, restoring the abbreviation to the original text, and then contribute to understanding the mission enlightenment, thereby strengthening memory. E.g:
Increment INCREMECT reduction DNC-Decrement
Short transfer SJMP-SHORT JUMP Chang transfer LJMP-long jump
Comparison transfer CJNE-Compare Jump Not equality
Absolute Transfer AJMP-ABSOLUTE JUMP Air Operation NOP-No Operation
Exchange XCH-Exchange addition add-addition
Multiplication MUL-MULTIPLICATION Div-Division
Left ring moves RL-ROTATE LEFT carry left ring move RLC-Rotate
Left carry
Right ring drove RR-ROTATE RIGHT RRC-ROTATE
Right Carry
3 Function Module Memory
The 44 instructions of the single chip microcomputer can be divided into five categories according to the instruction feature, and each class can be 2 to 3 groups. In this way, it is completely completed, and each break is broken and realizes rapid memory.
1) Data transfer group. 2) Addition and subtraction
MOV internal data transfer add add
MOVC program memory transmits ADDC carrying
MOVX external data transfer SUBB carrying subtraction
3) Logical operation group. 4) Subprogram call group.
ANL logic with LCALL long call
ORL logic or ALALL absolute call
XRL logical and RET subroutines return
Second, the memory method of the instruction
1 Directive symbol
There are six addressing methods of the MCS-51: immediate addressing, direct addressing, register addressing, register address, address addressing, relative addressing. We must master the method of its representation.
1) Immediate number and direct address.
TA indicates that eight digits, # data16 indicates that the number of immediate numbers, DATA or Direct represent direct address. 2) RN (n = 0-7), a, b, cy, DPTR register addressing variable.
3) @ r0, @ r1, @ DPTR, SP represents the register of the address variable.
4) DPTR A, PC A represents the variable of the address address.
5) PC REL (relative amount) represents a relative addressing variable.
Remember the mission of the instruction, master the representation of the number of instruction operands of different addressing methods, lay the foundation for our memory assembly instructions. Although MCS-51 instructions are much, it can be divided into five categories, including 28 data transfer classes, 24 arithmetic computing classes, 25 logical operation classes, 17 control transfer classes, and 17 Boolean operation classes. In each type of instruction, according to its function, the source, the different combinations of the destination operand, and then the following methods are completely remembered. We agree that the possible destination operands are represented in order (# DATA / DIRECT / A / RN / @ ri).
For MOV instructions, the target operand is written in the order of A, RN, Direct, @ ri, and 15 instructions for MOV can be remembered. For example, with the accumulator A, the following 4 instructions can be written.
Mov A, # data / limited / A / RN / @ ri
In this kind, other instructions are written.
Mov rn, # data / direct / a
Mov Direct, # data / direct / a / rn / @ ri
Mov @ ri, # data / Direct / A
2 Directive illustrated memory method
The illustration of the memory method is the same or similar to the operation function, but the number of operands different, the relationship between the graphics and arrows, the relationship of the source operand, is a memory method. For example, by sending a group command consisting of a macrper MOV, MOVX, MOVC, can be used to help memory with Figures 1, 2.
Four instructions formed by the macrper CJNE can also be represented by a graphical method, as shown in FIG.
CJNE A, # data, rel Cjne A, Direct, Rel
CJNE @ rn, # data, rel cjne @ ri, # data, reler
Further, for the 18 logical operation instructions formed by (ANL, ORL, ARL), the four annular displacement instructions of A may be represented by the illustration, and the reader will draw a memory itself.
3 Similar functional classification
In the MCS-51 instruction, we found that some instructions are different, but the function is similar, and the operand is exactly the same. The similar functional classification method is to remember the instructions with such a feature, as long as one of them, the rest will remember. If the twelve instructions, or non-sub-instructions, or, or non-sub-instructions are now 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 described above is similar, and its operands are the same. Other additional (inc), minus 1 (DEC) instructions can also be handled.
4 口 记 记
For some instructions, we can remember the relevant functions into a practical language. Such as PUSH Direct and Pop Direct these two instructions. Beginners often definitely clear the changes in the stack SP, to compile such a sentence: (SP content) plus 1 (Direct content) re-entered the stack, (SP content) pop-up (to the Direct unit) SP 1. Another example is the storage of multiplication instructions, the divisor and divisions in the division instructions and the storage of the merchants, and the memory can be compiled as follows. MUL AB high position (deposit) B, low storage (exist) a.
Div AB A is divided by B, and the merchants (existed) A (below) B.
The method of several fast memory microcontroller instructions is introduced, and it is hoped to play a role in tabs, and believe that readers can find their way to remember in the process of learning a single-chip microcomputer. However, there is a good method is not enough, but also needs practice, that is, the examples of the examples and others written in the book, and the procedures are actually written in combination. Only in this way, you can better grasp the microcontroller command system.