Data transfer instructions
1) Instructions with the accumulator as the destination operand
MOVA,Rn
MOVA,direct
MOVA,@Ri
MOVA,#data
In the first instruction, Rn represents R0-R7. In the second instruction, direct refers to the direct address, and in the third instruction, it is what we just talked about. The fourth instruction is to send the immediate data to A.
Let's illustrate this with some examples:
MOVA, R1; send the value in the working register R1 to A, and the value in R1 remains unchanged.
MOVA,30H; send the value in memory unit 30H to A, and the value in unit 30H remains unchanged.
MOVA,@R1; first check the value in R1, take this value as the address, and send the value in this address unit to A. If the value in R1 is 20H before executing the command, the value in the 20H unit is sent to A.
MOVA, #34H; send the immediate number 34H to A. After executing this instruction, the value in A is 34H.
2) Instructions that operate on register Rn
MOVRn,A
MOVRn,direct
MOVRn,#data
The function of this set of instructions is to send the contents of the source address unit into the working register, and the source operand remains unchanged.
MCU Instructions (II)
Data transfer instructions
(3) Instructions with direct address as destination operand MOVdirect,A Example: MOV20H,AMOVdirect,RnMOV20H,R1
MOVdirect1,direct2MOV20H,30H
MOVdirect,@RiMOV20H,@R1
MOVdirect,#dataMOV20H,#34H
(4) Instruction with indirect address as destination operand MOV@Ri,A Example: MOV@R0,AMOV@Ri,directMOV@R1,20H
MOV@Ri,#dataMOV@R0,#34H
(5) The sixteen-digit transfer instruction MOVDPTR, #data168051 is an 8-bit machine. This is the only 16-bit immediate number transfer instruction. Its function is to send a 16-bit immediate number to DPTR. The upper 8 bits are sent to DPH and the lower 8 bits are sent to DPL. For example: MOVDPTR, #1234H, after execution, the value in DPH is 12H and the value in DPL is 34H. Conversely, if we send numbers to DPH and DPL respectively, the result is the same. For example, there are the following two instructions: MOVDPH, #35H, MOVDPL, #12H. It is equivalent to executing MOVDPTR, #3512H. Comprehensive exercises:
Give the result after each instruction is executed
MOV23H,#30HMOV12H,#34H
MOVR0,#23H
MOVR7,#22H
MOVR1,12H
MOVA,@R0
MOV34H,@R1
(23h)=30h
(12h)=34h
(R0)=23H
(R7)=22H
(R1)=12H
(A)=30H
(34H)=34H
MOV45H,34H
MOVDPTR,#6712H
MOV12H, VAT
MOVR0, DPL
MOVA,@R0
(45H)=34H
(DPTR)=6712H
(12H)=67H
(R0)=12H
(A)=67H
Note: The content is represented by brackets, such as (23H) represents the value in the internal RAM 23H unit, and (A) represents the value in the accumulator A unit.
Computer exercises:
Enter DOS state and enter the directory where WAVE is located, for example D:WAVE
Type MCS51
Press File->Open. When the dialog box appears, enter a file name in Name (see Figure 2). If the file already exists in the list below, open the file. If the file does not exist, create a new file.
Enter the above program in the blank space. See Figure 4. Use ALT+A to assemble it. Use F8 to execute it step by step. During the execution, pay attention to the changes in the values of the working register and the A accumulator on the left side of the screen.
The change of the value in the memory cannot be seen here, but can be observed in the following way (see Figure 5): Move the mouse to DATA, double-click, and the cursor will enter this line. At this time, you can use the up and down cursor keys on the keyboard to flip up and down to observe the change of the memory value. The data after the DATA at the front of this line represents the starting address of "a section", such as 20H now. Look at the top of the screen, the numbers from 0 to F, and the sum of the two is equal to the real address value. As shown in the figure, the values of memory 20H, 21H, 22H, and 23H are FBH, 0EH, E8H, and 30H respectively.
Figure 56. After running the program, you will enter its disassembly area, which is not what we want. To start from the beginning, you can use the CTRL+F2 function key to reset the PC value. Note that you will not see the original window at this time. To see the original window, please use ALT+4 or ALT+5 to switch. Of course, the above operations can also be performed through the menu. CTRL+F2 is to reset the program, use the RUN menu. The window uses the WINDOWS menu.
This time, let's get familiar with this software. To be honest, I don't like it very much. It is not convenient to operate, but this is the only software I can use on my machine. I have no choice but to introduce a better one to netizens next time.
Previous article:Design of Signal Generator Based on FPGA and 51 Single Chip Microcomputer
Next article:8051 MCU Tutorial Lesson 11: Arithmetic Operation Instructions
Recommended ReadingLatest update time:2024-11-16 14:54
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
- STC32G Series MCU Technical Reference Manual
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
- Selling various low, medium and high-end development boards
- EEWORLD University Hall ---- Zhougong Series Lectures —— Basic Principles of Zhougong PID
- Security monitoring system protection discussion
- 【GD32E231 DIY】IAR development environment construction and running lights
- [NXP Rapid IoT Review] + NXP Rapid IoT Unexpected Bluetooth IoT
- EEWORLD University Hall ---- Zhou Gong Series Lectures - Temperature Instruments
- Is there any impact if the power supply is connected using soldered wires during PCB wiring?
- Problems with making the digital tubes flash simultaneously
- EEWORLD University ----TI Precision Labs - Operational Amplifiers: 15 Comparator Applications
- 100% Earn E-Coins or Red Packets: Tektronix will help you solve USB development and testing problems. Download, complain/share experiences to win good gifts