Docsity

Micro Controller Instruction Set - Electrical Engineering - Lecture Slides, Slides of Electrical Engineering

Partial preview of the text

Download Micro Controller Instruction Set - Electrical Engineering - Lecture Slides and more Slides Electrical Engineering in PDF only on Docsity!

MICROCONTROLLERINSTRUCTION SET

Introduction 

An instruction is an order or command givento a processor by a computer program. Allcommands are known as instruction set andset of instructions is known as program.

8051 have in total 111 instructions, i.e. 111different words available for program writing.

Types Of Instructions 

Instructions are divided into 3 types;

One/single byte instruction.

Two/double byte instruction.

Three/triple byte instruction.

Types Of Instructions 1.

One/single byte instructions :

If operand is not given in the instruction orthere is no digits present with instruction,the instructions can be completelyrepresented in one byte opcode.

OPCODE

8 bit

Types Of Instructions

  1. Three/triple byte instruction: 

If 16 bit number is given as operand in theinstructions than such instructions can becompletely represented in three bytes 16 bitnumber specified may be data or address.

Types Of Instructions

First byte will be instruction code.

Second byte will be 8 LSB’s of 16 bit number.

Third byte will be 8 MSB’s of 16 bit number.

First byte

OPCODE.

Second byte

8 LSB’s of data/address.

Third byte

8 MSB’S of data/address.

Addressing Modes 

There are 5 types of addressing modes:

Register addressing.

Direct addressing.

Register indirect addressing.

Immediate addressing.

Index addressing.

Register Addressing Mode 

In register addressing mode; the sourceand/or destination is a register.

In this case; data is placed in any of the 8registers(R0-R7); in instructions it is specifiedwith letter Rn (where N indicates 0 to 7).

Direct Addressing Mode 

In direct addressing mode; the address ofmemory location containing data to be readis specified in instruction.

In this case; address of the data is given withthe instruction itself.

Direct Addressing Mode 

For example;

MOV A, 25H (This instruction willread/move the data from internal RAMaddress 25H and store it in theaccumulator.

Register Indirect Addressing Mode 

For example;

MOV A,@R0 This instruction moves thedata from the register whose address is inthe R0 register into the accumulator.

Immediate Addressing Mode 

In immediate addressing mode, the data isgiven with the instruction itself.

In this case; the data to be stored in memoryimmediately follows the opcode.

Index Addressing Mode 

Offset (from accumulator) is added to thebase index register( DPTR OR ProgramCounter) to form the effective address of thememory location.

In this case; this mode is made for readingtables in the program memory.

Index Addressing Mode 

For example;

MOVC A, @ A + DPTR ( This instructionmoves the data from the memory toaccumulator; whose address is computedby adding the contents of accumulator andDPTR)