0% found this document useful (0 votes)
12 views8 pages

Logo Design for SMKN 2 Jiwan

1. The document discusses register and direct addressing models for assembly language. It provides examples of single register and two register instructions as well as direct addressing modes. 2. Indirect addressing modes are introduced, where registers are used to access memory locations. An example loads the content from a memory location addressed by the value in register X into register R24. 3. A program example writes values to memory locations using direct and indirect addressing with loops.

Uploaded by

Hadi Sleem
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

Logo Design for SMKN 2 Jiwan

1. The document discusses register and direct addressing models for assembly language. It provides examples of single register and two register instructions as well as direct addressing modes. 2. Indirect addressing modes are introduced, where registers are used to access memory locations. An example loads the content from a memory location addressed by the value in register X into register R24. 3. A program example writes values to memory locations using direct and indirect addressing with loops.

Uploaded by

Hadi Sleem
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

chop ⑥ AVR Advanced ①

:
Assembly lwnguage

Register and Direct Addressing Moles

Single Register Inst


1- :
Rey
Li : INC R 3 R OR RIO

2 .
Two Registers :
Inst Rot Rs
,

ADD R2 RI AND R 20 R 23
ex : ,

Direct
Addressing Mook Rd
{
3 .
:
LDS ,
cobbers

STS oobhers ,
Rs

on

{
IN Rot ,
Io
Reg
out Io Rs
Rey ,

Indirect Mole
oobhessiny

have indirect Mole


we ] registers used
for oowhening :

X ol 2
, Y on

each one is 16 bit


Rst RIG

X : XH XL

RIS R28

Y :
y H YL
R 31 R 30
Z i ZH 2L
LD R2 4 , X ②
load into R24 the content of the memory locution

whose others is in register X

is
:
'

iii.
" "

÷:
LD
:
RIP ,
o

XH XL
⇒ X = ox 131
u X ol 31

LD Rid , X ⇒ RIP = b

ED L DI R2 3 0×55 Z = ox 513
,

}
LD I 2L
, 0×13 ⇒

LD I 2 H o X us
,

ST 2 ,
R2 } ⇒
0×513
Ey write to write into
a
program oxss
memory ③
locutions 0×140 hi 0×144 using
direct mole
of abhorring
b) indirect oubhenig monk

4 loop
LDI
soya ) LD I Rlb ,
0×55 b) Rib ,
oxss

LDJ XL 0×40
RIG
,
STS 0×140 ,
LDI XH oxol
,
STS 0×141 ,
RH
ST X , Rtb
STS 0×142 Rib
,
INC XL
STS 0×143 ,
Rib
ST X RH
STS ,
011144 ,R16
INC XL

ST X , Rib
c) LDI RIB ,
0×55
INC XL
L DI XL 0×40
,
ST x ,
Rtb
LD I XH 0×01
,
INC XL
L DI RIO 5
,
ST X , RIG

loop : ST X Rko
,

INC XL

DEC RIO

BRNE loop
Increment und onto decrement
Auto ③
-

LD Rn ,
x ⇒ hood into Rn the contents

of the

in X

nenewywheseoobhenni
LD Rn Xt ⇒ hood - - - -
- .

,
-
.

-
-
-
-
then increment X

LD Rn -
X ⇒ Decrement x then loot
,

lost example : LDI RIO ,


S -
s . - -

LD I Rlf 0×55 →
. -
-

L DI LBJ
XL , ox 40 or XL
, 0×45
LD I ol XH
XH OX LD I , oxol
,

loop ST Xt Rib loop ST x RK


-

: ,
,

DEC RIO DEC R 20

BRNE loop BRNE loop

Nib if ol FF
'

: X : ox

INC XL ⇒ XL : 0×00

and the does not


Carry
go to XH
and its
⇒ X = ox 0100 wrong
it's why it's better to

use auto inherit


write to clan 16 locutions ④
ED program memory
o -

of
storting 0×60
using
a
) Inc Rn

b ) Auto -
increment

16
soy of LDI Rtb ,
bI - . -

L DI XL ox 60 .
- -

LDI XH 01100
,
-
- -

LD I R 20 ,
0 - - -
-

loop : ST X
,
R 20 loop : ST At
,
RIO

INC XL DEC R 16

RH
DEC BRWE loop
BRNE loop

nib lost loot


in
example we On

0×70 then ST X R2
by
-

we
X ,
:
use ,
Register bit [Link] ⑤

BitiSIR
: set
Register

bit
SBR Rot hi ⇒
,

Clear Bit in Register


CBR Rot hi clan
-

in Rd vuhsebitin
omg

,

Kiss

ED LDI RIO 01140

20,0×151
,

20=0×80
SBR R 20 ob 10000001
,

[Link]
C BR
0×51--0101000=1
R

RIO = ?

Self ① ⇒ RIO = 01140 = 0100 0000

04100000=1
0001
② ⇒ RIO =
I 100

③ ⇒ RIO = I 000 0000

⇒ R
check u - bit in o -
Register ⑥

iftkbith
SB RS :
Skip
meet instruction '
in Register is Set

S B R C Il 11 11 11 11 11 11 11 Cleon
i

E o -
switch is Connected to 4-

use SBRS to keep checking the switch

if switch
'
send to PORTD
'
N
:O = ,

if switch '
to
'
-
-
I =3 11 Y PORTD

CBI DD RC 7
Soy ,

LDI RIG ,
OXFF

out DDRD ,
R 16

loop : IN RIO , PINC

SB Rs R2 .
,
7

jmp No

I
'
LDI RIG ,
y
out PORTD , Rl 6

ymp loop ,

No '
.
LDI RIB ,
'
N

OUT PORTD Rib


,

zmp loop
⇐ write a
.m⑦to
program test
f- RAM heat

Contois shot it
o X 195 on even number ,
if so :

not
it to
port B ,
if : make it even and

send it to PORT B

soy LDI Rib ,


ox FF

out DDRB , if 16

Lbs R2 o
,
o
X ISS

S BR S R2 o
,
o

zmp even

RIO
jobPo RIO
C B R 00000001

even : out .
RTB ,

here
ymp here

You might also like