COS10004 Lecture 8.2 - LED FLash (Part 2) - Busy Wait Timer
COS10004 Lecture 8.2 - LED FLash (Part 2) - Busy Wait Timer
COS10004 Lecture 8.2 - LED FLash (Part 2) - Busy Wait Timer
Dr Chris McCarthy
INSERT DELAY WITH BUSY WAIT TIMER
• Pseudocode:
– Program GPIO18 LED for output
– Loop1:
• Turn LED on (pull GPIO18 high)
• Busy wait
• Turn LED off (pull GPIO18 low)
• Busy wait
– branch to loop1
r2 - #1234;
set APSR with
ALU flags
• cmp r2,#1234 compare r2
and #0
'dec' in
subtract 1
some asm
from r2
• sub r2,#1
subtract
r2 = r2 - 1
r2--
to register
2
25/9/20 COS10004 Computer Systems 14
DETAILS
branch if not
equal if the z flag is
clear, goto loop1