Professional Documents
Culture Documents
covers 4+5
be done
Delay can 2 different
ways
:
1 . Times -
Also used for PWM I not covered in class
yet so we will use subroutine )
2 .
Subroutine
subroutine
-
We
normally run at -1MHz
,
% 1 machine
cycle
=
IcyI =
1µs
" "
IN
cycles
•
The instruction LDI RW ,
LW is one machine cycle .
Example delay :
Machine
cycles
delay : LDI RIG , OXFF
-
} ]
count DEC Rlq 1 the (1+2)%56 Internal External
÷
:
BRINE count 2 z we ,
loop Loop
DEC 1218
BRNE count 1
0th) 42 Machine
=
,
% total cycles ≈ 2562
oat spine , no
SER RIG
OUT DDRD ,
Rtb
*
Code continued next
page
on
?⃝
LED Blinking
-rLrw→
'
LDI RIG ,
OXFF •
Delay of interval t .
6 aft
"
for
"
LDI RW , •
Use a counter n number intervals .
inner :
delay calculation (41-27256+(1+41)) -256
Eye
DEC 1222
•
=
BRNE inner
BRNE outter
EOR 1219
,
1218
DEC RW
BRINE three -
blk
the Rat
Generating
Bonus for randomly the rat
points displaying
•
•
Can also stare the rat location in the Roll and then that location to
pass
the Port .
Rats
•
•
DB
DB
OB
OB
oooo
oooo
0001
tooo
} ×
# of rats .