Addressingmodes Unit 1
Addressingmodes Unit 1
ES & IN S T
R U C T IO N S SET O
F
8 0 51 M IC R O C O N T
R O LLER
A d d r e s s in g m o
des
Definition:-
1
3
C
o n t in u e …
▶ Ex:-
MOV R0,40H // save content of
RAM
MOV 56H,A // location 40h into
save content of
R0.
A in RAM location
56H.
R e g is te r in d ire c t a d d re
s s in g m o d e
MOVC A,@A+PC
2
3
E x te rn a l a d d re s s in g m
ode
o r In d e xe d add
(b)sData
re s in gaccess
m o(RAM
d e access)
■ E.g. MOVX
A,@DPTR MOVX
@R0,A Prof. Nitin 2
Ahire 4
C
o n t in u e …
▶ In this instruction the content of A
are added to the 16-bit register
DPTR to form the 16-bit address of
the needed data.
In s tru c tio n set o f 8
0 51
8051 simple instruction
has different set in There are:
■ groups.
Arithmetic instructions
■ Logical instructions
■ Data transfer instructions
■ Branching and looping
instructions
■ Bit control instructions
A rith m e t ic
in s tru c tio n s
These instructions are
used to perform various
mathematical operations like
addition, subtraction,
multiplication, and division etc.
C
o n t in u e …
■ ADD A, // Add the content of
R1 to
■ register1
ADDC A,#2 // Add 2 to Accumulator
accumulator with
carry
■ SUBB A,R2 // Subtract
content of register2
from
Accumulator
C
o n t in u e …
■ INC A // Increment
■ DEC A accumulator
■ M UL // Decrement
■ AB
DIV AB accumulator
// Divide A
by B // Multiply A and B
L o g ic a l in
s tru c tio n s
■ Thethe instructions
are logical which areused
instructions
for
performing some operations like
AND, OR, NOT, X- OR and etc., on
the operands.
C
o n t in u e …
■ ANL A, Rn // AND register to
accumulator
■ ORL A, Rn // OR register to
■ accumulator
CLR // Clear Accumulator
■ XRL
A A, Rn////Complement
Exclusive OR Reg to
■ Acc
CPL Accumulator
A
D a ta T r a n s f e r
In s tru c tio n s
■ These instruction are used to
transfer the data from source
operand to destination operand. All
the store, move, load, exchange
input and output instructions
belong to this to this group.
C
o n t in u e …
■ MOV A, // Move Reg to
■ Rn
MOVX A,@DPTR Acc
// Move external
RAM
■ PUSH // to Accumulator
PUSH direct byte
direct on to stack
■ POP // POP direct byte
direct from stack
B ra n c h a n d L o o p
in g In s tru c tio
ns
■ These instructions are bot
used for branching as we l h
■ as looping.
These instructions include
conditional & unconditional
jump or loop instructions.
C o n d itio n a l J u m p
In s tru c tio n s
■ JC // Jump if carry equal to
one
■ JNC // Jump if carry equal to
zero
■ JB // Jump if bit equal to
one
■ JNB // Jump if bit equal to
zero
■ J BC // Jump if bit equal to
one and clear bit
C
o n t in u e …
■ JZ // Jump if A=Zero
■ JNZ // Jump if A not equal to
■ DJN zero
Z // Decrement and Jump if
not equal to zero.
U n c o n d itio n a l
Jum p
In s tru c tio n s
■ In 8051 there two unconditional
jumps. They are:
■ SJMP // Short
■ LJMP jump
// Long
jump