Sunteți pe pagina 1din 2

MICROPROCESSOR SYSTEMS LABORATORY

(ECE515)

EXPERIMENT 3

BRANCH AND SUBROUTINE

OBJECTIVES

1. To perform branch and subroutine program


2. To understand the usage of flags in Processor Status Register (PSR)

PROCEDURE

PART A

1. Design a programming flowchart to perform the following:

If the left pushbutton is clicked, the left LED is switched on and the right LED is switched
off. The seven-segment LED will display “1”. If the right pushbutton is clicked, the right LED
is switched on and the left LED is switched off. The seven-segment LED will display “2”.

2. Based on the flowchart, write an ARM assembly language program using Notepad++.
Run and test your program using ARMSim#.

PART B

1. Design a programming flowchart to perform the following:

Design a program to blink LEDs in 1 second. First, the left LED is switched on and the right LED
is switched off. After 1 second, the left LED is switched off and the right LED is switched on and
the program continue to blink the LEDs.
2. Based on the flowchart and the main program below, write a 1 second delay subroutine.
3. Run and test your program using ARMSim#.

_start:
MOV R0,#04
MOV R1,#1
LDR R2,=MyString @display message in LCD
SWI 0x204
MOV R0,#4
MOV R1,#2
LDR R2,=MyString2 @display message in LCD
SWI 0X204
AGAIN: MOV R0,#0x02 @light up left LED
SWI 0X201
BL MyDelay @ call delay subroutine
MOV R0,#0x01 @light up right LED
SWI 0X201
BL MyDelay @ call delay subroutine
B AGAIN

MyDelay:

< write your program here>


MOV PC, R14

.data
MyString: .asciz "WELCOME TO THE CLASS"
MyString2: .asciz "LED BLINKING IN 1 SECOND"
.equ SWI_GetTicks, 0x6d
.end
Submit the followings:

a. Complete programming flowchart. (hardcopy)


b. ARM assembly language program listing with complete documentation. (hardcopy)
c. Assessment rubric. (hardcopy)
d. Softcopy of the assembly language program listing (*.s) file.

S-ar putea să vă placă și