Lecture 2
Lecture 2
Embedded Systems
CHAPTER 5
8051 ADDRESSING
MODES
OBJECTIVES
List the five addressing modes of the 8051 microcontroller
Contrast and compare the addressing modes
Code 8051 Assemblv language instructions using each
addressing mode
Access RAM using various addressing modes
List the SFR (special function registers) addresses
Discuss how to access the SFR
Manipulate the stack using direct addressing mode
Code 8051 instructions to manipulate a look-up table
Access RAM, I/O, and ports using bit addresses
Discuss how to access the extra 128 bytes of RAM space in
the 8052
Addressing Modes
The various addressing modes of a
microprocessor are determined when it is
designed, and therefore cannot be changed by
the programmer.
The 8051 provides a total of five distinct
addressing modes.
– (1) immediate
– (2) register
– (3) direct
– (4) register indirect
– (5) indexed
Immediate addressing mode
Table 5–1
8051 Special Function Register
(SFR) Addresses
Stack and direct addressing mode
Another major use of direct addressing mode is
the stack.
In the 8051 family, only direct addressing mode
is allowed for pushing onto the stack.
An instruction such as "PUSH A" is invalid.
Pushing the accumulator onto the stack must be
coded as "PUSH 0E0H.
Direct addressing mode must be used for the
POP instruction as well.
"POP 04" will pop the top of the stack into R4 of
bank 0.
Register indirect addressing mode
Bit-addressable RAM
Figure 5–1
16 Bytes of Internal RAM. Note:
They are both bit- and byte-accessible.
SECTION 5.3: BIT ADDRESSES FOR
I/O AND RAM
Bit-addressable RAM
Registers bit-addressability