Question: ( a ) ( 1 0 pts ) Generate the machine code corresponding to the Delay and Long _ Delay subroutines of the following AVR

(
a
)
(
1
0
pts
)
Generate the machine code corresponding to the Delay and Long
_
Delay
subroutines of the following AVR assembly program. Use hexadecimal numbers to
represent the resulting code FOR EACH ASSEMBLY PROGRAM LINE THAT
GENERATES A MACHINE CODE.
(
b
)
(
5
pts
)
What is the size of this program in bytes?
(
c
)
(
5
pts
)
What are the values of R
2
0
,
R
2
1
,
R
2
2
after the execution of Long
_
Delay
subroutine?
(
d
)
(
5
pts
)
How long is the delay introduced by a single call of the following subrou
-
tine Long
_
Delay in seconds with a
1
clock frequency?
(
e
)
(
5
pts
)
What should be the minimum stack size to call the Long
_
Delay subrou
-
tine?RESET :
; Stack initialization
ldi R16, low (RAMEND)
out SPL, R16
ldi R16, high (RAMEND)
out SPH, R16
Delay:
ldi R20, $00
ldi R21, $01
D1:
subi R20,1
sbci R21,0
brcc D1
ret
Long_Delay :
ser R22
LD1:
rcall Delay
dec R22
brne LD1
ret
 ( a ) ( 1 0 pts ) Generate the machine

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!