arm assembly instruction--LDR

Publisher:幸福满溢Latest update time:2016-04-07 Source: eefocusKeywords:arm Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The format of the LDR instruction is: 

LDR {condition}   destination register     

Function: Transfer 4 consecutive bytes (1 word) of data at the address pointed to by the memory address to the destination register.

The addressing mode of the LDR instruction is relatively flexible, as shown below:

LDR R0, [R1]                                                       ; read the word data at memory address R1 into register R0.

LDR R0, [R1, R2]                                             ; read the word data at memory address R1+R2 into register R0.

LDR R0, [R1, #8]                                             ; read the word data at memory address R1+8 into register R0.

LDR R0, [R1], R2                                               ; read the word data at memory address R1 into register R0, and store the value of R1+R2 into R1.

LDR R0, [R1], #8                                                ; read the word data at memory address R1 into register R0, and store the value of R1 + 8 into R1.

LDR R0, [R1, R2]!;                                          Read the word data at memory address R1+R2 into register R0, and store the value of R1+R2 into R1.

LDR R0, [R1, LSL #3]                                    ; read the word data at memory address R1*8 into register R0.

LDR R0, [R1, R2, LSL #2]                         ; read the word data at memory address R1+R2*4 into register R0.

LDR R0, [R1,,R2, LSL #2]!                       ; Read the word data at memory address R1+R2*4 into register R0, and store the value of R1+R2*4 into R1.

LDR R0, [R1], R2, LSL #2                            ; read the word data at memory address R1 into register R0, and store the value of R1+R2*4 into R1.

LDR R0, Label                                                ; Label is the program label, and Label must be within the range of -4~4KB of the current instruction.

 

To be careful of

LDR Rd, [Rn], #0x04                                                              ; here Rd is not allowed to be R15.

 

In addition, the instruction format of LDRB is similar to that of LDR, except that it reads 8 bits (1 byte) in the memory address into the destination register.

The instruction format of LDRH is also similar to that of LDR, which reads 16 bits (half word) from the memory into the destination register.

 

LDR R0, = 0xff

Here LDR is not an ARM instruction, but a pseudo-instruction. This is very similar to MOVE, except that the immediate value after the MOV instruction is limited. This immediate value must be a number in the range of 0X00-OXFF that is shifted right an even number of times, so MOV is more difficult to use because some numbers are not so easy to see whether they are legal.

Keywords:arm Reference address:arm assembly instruction--LDR

Previous article:arm assembly instruction--STR
Next article:Parameter passing method for calling C function in ARM assembly

Recommended ReadingLatest update time:2024-11-16 15:02

ARM bare metal program development - button control LED light
In the past few days, I have studied the IO control pins on TQ2440, learned about the configuration of some registers about the pins, and became familiar with the process of writing ARM bare metal programs. I will write down what I have learned. ★Program startup initialization ◇ Turn off the watchdog There is a speci
[Microcontroller]
ARM Basics - Characteristics and Application Fields of Various ARM Cores
1. ARM7 microprocessor series The ARM7 series microprocessors are low-power 32-bit RISC processors, which are most suitable for consumer applications with high price and power requirements. The ARM7 microprocessor series has the following features: - With embedded ICE-RT logic, it is easy to debug and develop. - E
[Microcontroller]
[ARM bare board] Timer interrupt example and analysis
1. Timer structure analysis  1. Every time a CLK comes, TCNTn decreases by 1  2. When TCNTn == TCMPn, (the corresponding PWM pin can be flipped) The values ​​of TCNTn and TCMPn come from registers TCNPBn and TCMTBn  3.TCNTn continues to decrease by 1. When TCNTn == 0, an interrupt can be generated (the PWM pin flips a
[Microcontroller]
[ARM bare board] Timer interrupt example and analysis
【Technical Support】Building the Qt environment for ARM9 development board
Note: Do not use the QT that comes with the package or installed using apt-get. If there is any, delete it. The development board must be able to mount NFS. This article uses other people's teaching materials, but I have slightly modified them. Because when I first looked for files to do it, I found many mistakes th
[Microcontroller]
ARM series processor architecture
1. Commonly used embedded processors include ARM, MIPS, PowerPC, X86, 68K/Cold fire, etc. MIPS is the abbreviation of Microprocessor without Inter-locked Pipeline Stages, which is a processor core standard developed by MIPS Technology. There are currently 32-bit and 64-bit MIPS chips. PowerPC is a CPU chip jointly deve
[Microcontroller]
Design of multi-tag multi-protocol RFID reader based on ARM
Introduction With the development of modern information technology and ultra-large-scale integrated circuits, RFID technology has been increasingly widely used in the service field, goods sales and logistics distribution, commercial departments, production enterprises and material circulation. The basic principle of
[Microcontroller]
Design of multi-tag multi-protocol RFID reader based on ARM
Keil (MDK-ARM) series tutorial (three)_project target option configuration (I)
II. Main Points This article mainly describes the configuration of target options. However, in order to let more people understand what target options are, we will first briefly describe the meaning and differences between workspace, project, and target. 1. Two ways to open target options 1. Click the target option
[Microcontroller]
Keil (MDK-ARM) series tutorial (three)_project target option configuration (I)
ARM interrupt source timer interrupt
Real-time clock request interrupt. In the control, when timing detection and control are encountered, an external clock circuit (programmable) is often used to control its time interval. When timing is required, the CPU issues a command to start the clock circuit. Once the specified time is reached, the clock circuit
[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号