1. Draw the flowchart of the following program. And use conditional execution instructions to simplify the program:
CMP R0, #10
BEQ ROUTINE
ADD R1,R1,R0
SUB R1,R1,R2
ROUTINE
...
2. Use ARM assembly to implement statements in C language
(1)
If ((R0= =R1) && (R2= =R3))
R4++;
Answer 2
GDC
CMP R0,R1
BEQ END
SUBLT R1,R1,R0
SUBGE R0,R0,R1
B GDC
END 。 。
4.
Answer 1 SUBS R2,R2,#0x1 MULNE R0,R1,R2 MOVNE R1,R0 Answer 2 SUBS R2
,R2,# 0x1 MUL R0,R1,R2 MOV R1,R0 CMP R2,#1 BNE LOOP
Keywords:ARM
Reference address:ARM conditional execution instructions
ROUTINE
2.
(1)
If ((R0= =R1) && (R2= =R3))
R4++;
(2)
int gcd(int a, int b)
{
while(a!=b)
{
if(a>b)
a=ab;
else
b=ba;
}
return a;
}
int gcd(int a, int b)
{
while(a!=b)
{
if(a>b)
a=ab;
else
b=ba;
}
return a;
}
(3) Calculate n using the idea of conditional execution! (exp7.4.s)
AREA factorial, CODE, READONLY
ENTRY
START
MOV R2, #0xA
MOV R1, R2
LOOP
; Decrement R2 and update the status flag
; Multiply, note that the result register should be different from the source register
; Save the product and prepare for the next calculation
BNE LOOP
STOP
B STOP
END
1. CMP R0, #10
ADDNE R1, R1, R0
SUBNE R1, R1, R2
2. CMP R0,R1
CMPEQ R2,R3
ADDEQ R4,R4,#1
3.
Answer 1
GDC
CMP R0,R1
BEQ END
BLT LESS
SUB R0,R0,R1
B GDC
LESS
SUB R1,R1,R0
B GDC
END . . .
START
LOOP
STOP
1.
ADDNE
SUBNE
|
2.
CMPEQ R2,R3
ADDEQ R4,R4,#1
3.
Answer 1
GDC
LESS
END
Answer 2
GDC
SUBGE R0,R0,R1
END
4.
Answer 1 SUBS R2,R2,#0x1 MULNE R0,R1,R2 MOVNE R1,R0 Answer 2 SUBS R2
,R2,# 0x1 MUL R0,R1,R2 MOV R1,R0 CMP R2,#1 BNE LOOP
Previous article:ARM control transfer instructions
Next article:ARM subroutine design
Recommended ReadingLatest update time:2024-11-23 08:07
Learn peripherals one by one for ARM_first
LED lights are used in almost every board, not to mention their importance:
According to the schematic diagram provided by s5pc100, we can see
The control register used is GPG3
Check the relevant chip manual:
GPG0,1,2,3: 25 in/out pin –3xMMC channel (Channel 0 supports 4-bit and 8-bit mode, but channel 1,
[Microcontroller]
Linux Embedded ARM-Linux Basics
ARM Architecture 1. Please briefly describe the characteristics of ARM processors, and state at least 5 characteristics. (5 points) : low power consumption; low cost, high performance, RISC structure; fixed instruction length; support Thumb (16-bit)/ARM (32-bit) dual instruction sets; small size; 2. Please write the s
[Microcontroller]
How powerful is Arm Immortalis based on the new fifth-generation GPU architecture?
GPU now seems to have surpassed CPU, whether on the desktop, server or mobile phone, it can significantly improve the user experience in image processing or ML processing. Arm recently launched the Immortalis-G720, which uses the fifth-generation GPU architecture, which will bring new experiences to various devices. A
[Mobile phone portable]
ARM stack study notes
The following is what I learned about the stack when studying ARM instructions: 1. Register R13 is often used as a stack pointer in ARM instructions 2. For the R13 register, it corresponds to 6 different physical registers, one of which is shared by user mode and system mode, and the other 5 physical registers corre
[Microcontroller]
Design of 3G video helmet based on ARM11 and DSP collaborative video stream processing technology
1. Introduction
In order to improve the controllability of on-site operations in high-risk workplaces, this paper adopts bionic principles and high-integration design to realize a 3G video helmet with the same viewing angle as the human eye. This design consists of a video helmet and a waist-span data processing
[Microcontroller]
Design of fingerprint recognition access control system based on ARM
1 Overview With the continuous advancement of science and technology, people have put forward higher-level security management requirements for modern office and living places. Ordinary door lock systems and manual access management no longer meet the actual needs of modern people. Due to the intelligence and netw
[Microcontroller]
The easiest way to install the GCC toolchain for ARM architecture in Ubuntu
1. Install the ARM-Linux-GCC toolchain Just one command: sudo apt-get install gcc-arm-linux-gnueabi The premise is that your Ubuntu system version is the latest version supported by the official website. If not, please upgrade. Execute the above command. 2. Using the Toolchain Note! You cannot use the gc
[Microcontroller]
AT91 Series ARM Hardware Design Notes
Power Issues
1.VDDCORE and VDDIO pin power supply
A) The VDDCORE and VDDIO pin supplies must be connected to a clean DC power supply using decoupling capacitors; the decoupling capacitors should be as close as possible to the VDD and GND pins of the microcontroller; the typical value of the decoupling capa
[Industrial Control]
Recommended Content
Latest Microcontroller Articles
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
MoreDaily News
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
Guess you like
- DE1-SOC development board usage learning
- The use of stack in DSP
- 3D printed python pen holder
- TI Smart POS System Block Diagram Analysis and Its Seven Key Functional Module Solutions
- Cubietruck dual-core A20 development board
- TI DSP simulator type selection
- Comparison between C++ Builder and VC
- When developing automotive instrument clusters for HMI, should we use algorithms or HAP?
- The display principle of the segment code screen, for example, to display the word high voltage, which two pins are driven, and high voltage is a character, isn't it...
- Please share the software test information, and also complain about the software test