1. Find the time delay for the delay subroutine shown below if the system has an
ID: 1814499 • Letter: 1
Question
1. Find the time delay for the delay subroutine shown below if the system has an AVR with a clock frequency of 20 MHz. Do not consider the time delay required to call the delay subroutine. In other words, start the delay calculation after the first LDI instruction in the subroutine has been fetched. Do include the time required to fetch and execute the RET instruction. Instruction cycle times are provided in the handout. SHOW YOUR WORK including the number of clock cycles per instruction and how you add these up to get the total delay.
DELAY: LDI R20, 200
BACK: LDI R25, 100
NOP
NOP
NOP
HERE: DEC R25
BRNE HERE
DEC R20
BRNE BACK
RET
Explanation / Answer
cycles = 1+ (4 + (300-1)+1+2)*200-1
cycles = 306*200
delay = 306*200/(20*10^6) = 3.06msec
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.