You are on page 1of 23

Established as per the Section 2(f) of the UGC Act, 1956

Approved by AICTE, COA and BCI, New Delhi

Microcontrollers and Applications


Unit 2 (Features of 8051)
School of EEE

Latha N
16/09/2020
CONTENTS- FEATURES OF 8051
UNIT – 2 Total duration = 9 Hours teaching +2 Hours discussion

Instruction set of 8051 along with simple programs

Addressing modes of 8051 along with simple programs

Data types and Time delay, I/O programming

Logical operations and Data conversion programs in 8051 C

Timers/Counters and programming

Interrupts and programming


FEATURES OF 8051

Unit Objective:

Demonstrate the skill of programming the microcontroller for a given application.


OUTLINE
Recap of previous Lecture

Topic for the Lecture

Objective and Outcome of Lecture

Lecture Discussion

Introduction to Instruction set in 8051

Different Addressing Modes with Examples


OBJECTIVE AND OUTCOME OF
Features of 8051
LECTURE

Lecture Explain the basics of Instruction sets in 8051 and Addressing modes
Objective

Lecture
Outline the basics of Instruction sets and Addressing modes of 8051
Outcome
FEATURES OF 8051

Instruction set of 8051:

The commands to the Microcontroller are known as a Microcontroller’s


Instruction Set

Commands given to the microcontroller to perform a specific task


FEATURES OF 8051

Instruction set of 8051:

8051 Microcontroller Instruction Set is optimized for 8-bit control applications

The 8051 Microcontroller instruction set can have up to 28 = 256 Instructions
FEATURES OF 8051

Instruction set of 8051:

In 8051, there are 49 Instruction Mnemonics

Instruction Set and these 49 Mnemonics are divided into five groups
FEATURES OF 8051
Data transfer instructions

Arithmetic instructions

Instruction set of
Logical instructions
8051

Boolean instructions

Program branching and


machine control
FEATURES OF 8051

Instruction set of
8051
FEATURES OF 8051

8051 Addressing Modes A way to locate a target Data - Operand

8051 Addressing Modes

Register –
Immediate Register Direct Indexed
Indirect
Addressing Addressing Addressing Addressing
Addressing
FEATURES OF 8051

8051 Addressing Modes


Immediate Addressing

In this Immediate Addressing Mode, the data is provided in the instruction itself

The data is provided immediately after the opcode


FEATURES OF 8051

8051 Addressing Modes


Immediate Addressing
Example:
MOV A, #0AFH; Move data # is used for A represents
immediately to immediate data accumulator
Accumulator
MOV R3, #45H; Move data # is used for R3 represents Register
immediately to immediate data
register R3
FEATURES OF 8051

8051 Addressing Modes


Immediate Addressing

MOV DPTR, #FE00H; Move data immediately to # is


used for The DPTR stands for
Data Pointer immediate data. Data Pointer.

DPTR It points the external data memory location 


FEATURES OF 8051

8051 Addressing Modes


Register addressing mode

One of the eight registers (R0 – R7) is specified as Operand in the Instruction

Important to select the appropriate Bank with the help of PSW Register
FEATURES OF 8051

8051 Addressing Modes


Register addressing mode
Example:
MOV A, R5; Accumulator is the destination Register R5 is the source

MOV R2, #45H; Register R2 is the destination #45H is the immediate data

MOV R0, A; Register R0 is the destination A -> Accumulator is the source


FEATURES OF 8051

8051 Addressing Modes


Direct Addressing Mode

The source or destination address is specified by using 8-bit data in the instruction

Only the internal data memory can be used


FEATURES OF 8051

8051 Addressing Modes


Direct Addressing Mode
Example:
MOV 80H, R6; 80H is the destination R6 is the source Data is moved from
Address Register Register to Internal
Memory
MOV R2, 45H; R2 is the destination 45H is the source Data is moved from
Register Address Internal memory to
Register
MOV R0,05H; R0 is the destination 05H is the source Data is moved from
Register Address Internal memory to
Register
FEATURES OF 8051

8051 Addressing Modes


Register indirect addressing Mode

The source or destination address is given in the register

The internal or external addresses can be accessed


FEATURES OF 8051

8051 Addressing Modes:


Register indirect addressing Mode
Example:
MOV 0E5H, @R0 Address will be If the content of R0 @ symbol is used for
stored in Register R0 is 40H internal RAM, register indirect
Data from there is addressing
taken

MOV @R1, 80H; Address is stored in If Content of R1 is @ symbol is used for


Register R1 30H, then contents register indirect
of 80H( Port P0) will addressing
be stored in 30H
internal RAM
FEATURES OF 8051

8051 Addressing Modes


Indexed Addressing Mode

The source memory can only be accessed from program memory only

The destination operand is always the register A


FEATURES OF 8051

8051 Addressing Modes:


Indexed Addressing Mode
Example:

MOVC A, @A+PC; Suppose A holds 30H PC value is1125H The contents of program
memory location 1155H
(30H + 1125H) are
moved to register A.

MOVC A, @A+DPTR; Same as above Instead of PC


,DPTR is used
DISCUSSION
5 MINUTES

You might also like