Professional Documents
Culture Documents
8051_2018_lec4
8051_2018_lec4
Microprocessor 2021-22
Instructions for the Program memory
(external/internal)
MOVC A, @A+DPTR
3/14/2024 2
Instructions for the external RAM
Reading Data-Bytes from the external RAM
MOVX A , @DPTR Using 16-bit pointer
3/14/2024 3
Assume DPH= EEh & DPL= 44h
External
Address BUS
Ext. Address
BUS
3/14/2024
Before executing “MOVX” 4
After Executing MOVX A, @DPTR
3/14/2024 5
Executing MOVX @DPTR, A
3/14/2024 6
Before executing the instruction
MOVC A, @A+DPTR
3/14/2024 7
EXAMPLE
Write assembly sub-program to read a data-
byte from the program memory at the
address "0111h" and store it into external
RAM location at the address "0888h" using
the data transfer instructions.
3/14/2024 8
@A+DPTR Program External
@DPTR
Accumulator RAM
memory
; or CLR A
3/14/2024 9
3/14/2024 10
3/14/2024 11
The logical-operation instructions
2 operands
3/14/2024 12
Executing the “ORL” instruction
3/14/2024 13
Executing the “XRL” instruction
3/14/2024 14
Executing the “CPL” instruction
3/14/2024 15
Executing the “SWAP” instruction
3/14/2024 16
Executing the “RR A” instruction
3/14/2024 17
Executing the “RRC A” instruction
3/14/2024 18
EXAMPLE
Write assembly subprogram to perform the
logical operations in the following block
diagram, let the data in “A” without change
at the end of the code.
3/14/2024 19
3/14/2024 20
The Arithmetic Operation Instructions of
MCS-51
3/14/2024 21
3/14/2024 22
The arithmetic-operation instructions
ADD RX
ADDC A, Rn
SUBB @Ri
#data8
RX INC DPTR
INC Rn DIV AB
DEC @Ri
MUL AB
A
DA A
3/14/2024 23
Executing the “ADD” instruction
3/14/2024 24
Executing the “ADDC” instruction
3/14/2024 25
Executing the “SUBB” instruction
3/14/2024 26