MPMC IV Unit
MPMC IV Unit
MOV A, R0 A = <src> √ √ √ √
DPTR = 16-bit
MOV DPTR, #4000 immediate data
√
INC SP:
PUSH A MOV “@SP”, √
<scr>
MOV <dest>,
POP A “@SP”: DEC SP
√
Data Transfer Instructions
ACC and <byte> Exchange
XCH A, R0 Data
√ √ √
• The lower order byte -result is stored in A register and the higher
order byte - stored in B register.
A = Int [A/B]
DIV AB B = Mod [A/B]
Accumulator Only
Decimal Adjust
DAA Accumulator
Accumulator Only
Logical Instructions
• In addition to logical AND, OR and XRL operation, 8051 has
additional instructions - CLR, CPL. All the data for the logical
instructions -available in the internal RAM only.
<byte> = <byte>
ANL 7F, A AND A √
<byte> = <byte>
ANL 7F, #7F AND # data √
<byte> = <byte>
ORL <byte>, A OR A
√
<byte> = <byte>
ORL <byte>, # data OR # data
√
Logical Instructions
XRL A, <byte> A = A XOR <byte> √ √ √ √
• They are Absolute jump AJMP, ACALL, long jump LJMP, LCALL, and
short jump SJMP.
Unconditional Jumps
• SJMP <XX> ; Short jump, relative
address is 8-bit 2’s complement number, so
jump can be up to 127 locations forward, or
128 locations back.
• LJMP, 8100; Long jump
• AJMP <address 11> ; Absolute jump to
anywhere within 2K block of program memory
• JMP @A + DPTR ; Long indexed
jump
Conditional jumps
Mnemonic Description
JZ <rel addr> Jump if a = 0
JNZ <rel addr> Jump if a != 0
Jump if A ≠=
CJNE A,<byte> <byte>
√ √
Jump if <byte> =
CJNE <byte>,#data #data
√ √
ret ; PC stack
Branching Instructions
• The micro controller 8051 -single instruction for counter operation
to decrement -result (DJNZ). -very useful in looping using a
counter similar to “for loop” in high level languages.
• The internal data memory map of 8051 has a bit- addressable area
also.
ANL C,/bit √
ORL C,bit √
ORL C,/bit √
MOV C,bit √
CJNE √
© Oxford University Press 2013
ADDRESSING MODES OF 8051
• This instruction will add the contents stored in register R0 with the
accumulator contents and store the result in accumulator.
• The Registers A, B, DPTR and R0 to R7 are used in Register direct
addressing.
• This addressing mode uses temporary registers which hold the
data for the operation.
Memory Direct Addressing
• The memory address that contains the data to be operated is
specified here in the instruction.
• E.g. ADD A, 74h.
• This instruction adds the data in accumulator with that stored in
memory address 74h.
• All internal RAM addresses including that of special function
registers can be used in memory direct addressing instructions.
• This addressing mode is used when the data stored in memory is
to be used in arithmetic and logical instructions.
• The data in memory used in the direct addressing can be changed
at any other point in the program.
Memory Indirect Addressing
• The register, which contains the actual memory address of the
data, is specified in the instruction.
• The register specified is preceded by @ symbol in assembly
language format.
• The data pointer register (DPTR) is used to access the data in the
external memory with 16-bit addresses.