KEMBAR78
Microprocessor and Peripherals | PDF | Central Processing Unit | Microprocessor
0% found this document useful (0 votes)
2 views31 pages

Microprocessor and Peripherals

The document provides an overview of microprocessors, detailing their types including CISC, RISC, ASIC, Superscalar, and DSPs, along with their advantages and disadvantages. It also covers the evolution of microprocessors from 4-bit to 64-bit, highlighting significant models like Intel 4004, 8085, and Pentium series. Additionally, it describes the architecture and functional units of the 8085 microprocessor, including its instruction sets and sample programming demonstrations.

Uploaded by

atulthakur0632
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views31 pages

Microprocessor and Peripherals

The document provides an overview of microprocessors, detailing their types including CISC, RISC, ASIC, Superscalar, and DSPs, along with their advantages and disadvantages. It also covers the evolution of microprocessors from 4-bit to 64-bit, highlighting significant models like Intel 4004, 8085, and Pentium series. Additionally, it describes the architecture and functional units of the 8085 microprocessor, including its instruction sets and sample programming demonstrations.

Uploaded by

atulthakur0632
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Microprocessor and peripherals

Types of Microprocessor
Microprocessors are classified into five types, namely: CISC-Complex Instruction Set
Microprocessors, RISC-Reduced Instruction Set Microprocessor, ASIC- Application Specific
Integrated Circuit, Superscalar Processors, DSP’s-Digital Signal Microprocessors.
Complex Instruction Set Microprocessors
The short term of Complex Instruction Set Microprocessors is CISM and they classify
a microprocessor in which orders can be performed together along with other low level
activities. These types of processors performs the different tasks like downloading,
uploading, recalling data into the memory card and recalling data from the memory
card. Apart from these tasks, it also does complex mathematical calculations in a
single command.

Reduced Instruction Set Microprocessor


The short term of Reduced Instruction Set Microprocessor is RISC. These types of
processors are made according to the function in which the microprocessor can carry
out small things in specific command. In this way these processors completes more
commands at a faster rate.

Superscalar Microprocessors
Superscalar processor facsimiles the hardware on the processor to perform various
tasks at a time. These processors can be used for ALUs or multipliers. They have
different operational units and these processors can carry out more than a one
command by continuously transmitting several instructions to the extra operational
units inside the processor.

The Application Specific Integrated Circuit


The short term of Application Specific Integrated Circuit processor is an ASIC. These
processors are used for particular purposes that includes of automotive emissions
control or personal digital assistant’s computer. This type of processor is made with
proper specification, but apart from these it can also be made with off the shelf gears.
Digital Signal Multiprocessors
Digital signal processors are also called as DSP’s, these processors are used to
encode and decode the videos or to convert the D/A (digital to analog) &A/D (analog to
digital). They need a microprocessor that is excellent in mathematical calculations.
The chips of this processor are employed in RADAR, home theaters, SONAR, audio
gears, TV set top boxes and Mobile phones
There are many companies like Intel, Motorola, DEC (Digital Equipment Corporation
), TI (Texas Instruments) associated with many microprocessors such as 8085
microprocessors, ASIC, CISM, RISC, DSPs and 8086 microprocessors like Intel

Advantages and Disadvantages of Microprocessors


The advantages of microprocessors are

 The processing speed is high


 Intelligence has been brought to systems
 Flexible.
 Compact size.
 Easy maintenance
 Complex mathematics
Some of the disadvantages of microprocessor are it might get overheated and the
limitation of the microprocessor imposes on size of data.

The applications of the microprocessors mainly involve in controllers in home


appliances, wireless communication equipments, office publication and automation,
consumer electronic goods, calculators, accounting system, video games, industrial
controllers and data acquisition systems

Classification of Microprocessor:

The microprocessor is identified with the word size of data. For E.g. The ALU can perform a 4- bit data
operation at a time these microprocessor is called as 4-bit microprocessor.
4-Bit Processors

INTEL 404 4040

8-Bit Processors

8008 8080 8085 MOTOROLA 6800 (M6800)

16-Bit Processors

8086 8088 Zilog Z800 80186 80286

32-Bit Processors

Intel 80386 80387 80486 PENTIUM PENTIUM PRO

64-Bit Processors

Evolution of microprocessors

4-bit Microprocessors
The first microprocessor was introduced in 1971 by Intel Corp. It was named Intel
4004 as it was a 4 bit processor. It was a processor on a single chip. It could perform
simple arithmetic and logic operations such as addition, subtraction, boolean AND
and Boolean OR. It had a control unit capable of performing control functions like
fetching an instruction from memory, decoding it, and generating control pulses to
execute it. It was able to operate on 4 bits of data at a time.This
first microprocessor was quite a success in industry. Soon other microprocessors
were also introduced. Intel introduced the enhanced version of 4004, the 4040. Some
other 4 bit processors are International’s PPS4 and Thoshiba’s T3472.
8-bit Microprocessors
The first 8 bit microprocessor which could perform arithmetic and logic operations
on 8 bit words was introduced in 1973 again by Intel. This was Intel 8008 and was
later followed by an improved version, Intel 8088. Some other 8 bit processors are
Zilog-80 and Motorola M6800.
16-bit Microprocessors
The 8-bit processors were followed by 16 bit processors. They are Intel 8086 and
80286.
32-bit Microprocessors
The 32 bit microprocessors were introduced by several companies but the most
popular one is Intel 80386.
Pentium Series
Instead of 80586, Intel came out with a new processor namely Pentium processor.
Its performance is closer to RISC performance. Pentium was followed by Pentium
Pro CPU. Pentium Pro allows allow multiple CPUs in a single system in order to
achive multiprocessing. The MMX extension was added to Pentium Pro and the
result was Pentiuum II. The low cost version of Pentium II is celeron.
The Pentium III provided high performance floating point operations for certain
types of computations by using the SIMD extensions to the instruction set. These
new instructions makes the Pentium III faster than high-end RISC CPUs.
Interestingly Pentium IV could not execute code faster than the Pentium III when
running at the same clock frequency. So Pentium IV had to speed up by executing
at a much higher clock frequency.

Microprocessor - 8085 Architecture


8085 is pronounced as "eighty-eighty-five" microprocessor. It is an 8-bit
microprocessor designed by Intel in 1977 using NMOS technology.

It has the following configuration −

 8-bit data bus

 16-bit address bus, which can address upto 64KB

 A 16-bit program counter

 A 16-bit stack pointer

 Six 8-bit registers arranged in pairs: BC, DE, HL


 Requires +5V supply to operate at 3.2 MHZ single phase clock

It is used in washing machines, microwave ovens, mobile phones, etc.

8085 Microprocessor – Functional Units


8085 consists of the following functional units −

Accumulator
It is an 8-bit register used to perform arithmetic, logical, I/O &
LOAD/STORE operations. It is connected to internal data bus & ALU.

Arithmetic and logic unit


As the name suggests, it performs arithmetic and logical operations like
Addition, Subtraction, AND, OR, etc. on 8-bit data.

General purpose register


There are 6 general purpose registers in 8085 processor, i.e. B, C, D, E, H
& L. Each register can hold 8-bit data.

These registers can work in pair to hold 16-bit data and their pairing
combination is like B-C, D-E & H-L.

Program counter
It is a 16-bit register used to store the memory address location of the
next instruction to be executed. Microprocessor increments the program
whenever an instruction is being executed, so that the program counter
points to the memory address of the next instruction that is going to be
executed.

Stack pointer
It is also a 16-bit register works like stack, which is always
incremented/decremented by 2 during push & pop operations.

Temporary register
It is an 8-bit register, which holds the temporary data of arithmetic and
logical operations.

Flag register
It is an 8-bit register having five 1-bit flip-flops, which holds either 0 or 1
depending upon the result stored in the accumulator.

These are the set of 5 flip-flops −

 Sign (S)
 Zero (Z)

 Auxiliary Carry (AC)

 Parity (P)

 Carry (C)

Its bit position is shown in the following table −

D7 D6 D5 D4 D3 D2 D1 D0

S Z AC P CY

Instruction register and decoder


It is an 8-bit register. When an instruction is fetched from memory then it
is stored in the Instruction register. Instruction decoder decodes the
information present in the Instruction register.

Timing and control unit


It provides timing and control signal to the microprocessor to perform
operations. Following are the timing and control signals, which control
external and internal circuits −

 Control Signals: READY, RD’, WR’, ALE

 Status Signals: S0, S1, IO/M’

 DMA Signals: HOLD, HLDA

 RESET Signals: RESET IN, RESET OUT

Interrupt control
As the name suggests it controls the interrupts during a process. When a
microprocessor is executing a main program and whenever an interrupt
occurs, the microprocessor shifts the control from the main program to
process the incoming request. After the request is completed, the control
goes back to the main program.

There are 5 interrupt signals in 8085 microprocessor: INTR, RST 7.5, RST
6.5, RST 5.5, TRAP.

Serial Input/output control


It controls the serial data communication by using these two instructions:
SID (Serial input data) and SOD (Serial output data).
Address buffer and address-data buffer
The content stored in the stack pointer and program counter is loaded into
the address buffer and address-data buffer to communicate with the CPU.
The memory and I/O chips are connected to these buses; the CPU can
exchange the desired data with the memory and I/O chips.

Address bus and data bus


Data bus carries the data to be stored. It is bidirectional, whereas address
bus carries the location to where it should be stored and it is unidirectional.
It is used to transfer the data & Address I/O devices.

8085 Architecture
We have tried to depict the architecture of 8085 with this following image

Microprocessor - 8085 Pin


Configuration
The following image depicts the pin diagram of 8085 Microprocessor −
The pins of a 8085 microprocessor can be classified into seven groups −

Address bus
A15-A8, it carries the most significant 8-bits of memory/IO address.

Data bus
AD7-AD0, it carries the least significant 8-bit address and data bus.

Control and status signals


These signals are used to identify the nature of operation. There are 3
control signal and 3 status signals.

Three control signals are RD, WR & ALE.

 RD − This signal indicates that the selected IO or memory device is to be read


and is ready for accepting data available on the data bus.

 WR − This signal indicates that the data on the data bus is to be written into
a selected memory or IO location.
 ALE − It is a positive going pulse generated when a new operation is started
by the microprocessor. When the pulse goes high, it indicates address. When
the pulse goes down it indicates data.

Three status signals are IO/M, S0 & S1.

IO/M
This signal is used to differentiate between IO and Memory operations, i.e.
when it is high indicates IO operation and when it is low then it indicates
memory operation.

S1 & S0
These signals are used to identify the type of current operation.

Power supply
There are 2 power supply signals − VCC & VSS. VCC indicates +5v power
supply and VSS indicates ground signal.

Clock signals
There are 3 clock signals, i.e. X1, X2, CLK OUT.

 X1, X2 − A crystal (RC, LC N/W) is connected at these two pins and is used
to set frequency of the internal clock generator. This frequency is internally
divided by 2.

 CLK OUT − This signal is used as the system clock for devices connected with
the microprocessor.

Interrupts & externally initiated signals


Interrupts are the signals generated by external devices to request the
microprocessor to perform a task. There are 5 interrupt signals, i.e. TRAP,
RST 7.5, RST 6.5, RST 5.5, and INTR. We will discuss interrupts in detail
in interrupts section.

 INTA − It is an interrupt acknowledgment signal.

 RESET IN − This signal is used to reset the microprocessor by setting the


program counter to zero.

 RESET OUT − This signal is used to reset all the connected devices when the
microprocessor is reset.
 READY − This signal indicates that the device is ready to send or receive data.
If READY is low, then the CPU has to wait for READY to go high.

 HOLD − This signal indicates that another master is requesting the use of the
address and data buses.

 HLDA (HOLD Acknowledge) − It indicates that the CPU has received the
HOLD request and it will relinquish the bus in the next clock cycle. HLDA is set
to low after the HOLD signal is removed.

Serial I/O signals


There are 2 serial signals, i.e. SID and SOD and these signals are used for
serial communication.

 SOD (Serial output data line) − The output SOD is set/reset as specified by
the SIM instruction.

 SID (Serial input data line) − The data on this line is loaded into accumulator
whenever a RIM instruction is executed.

Microprocessor - 8085 Instruction Sets


Let us take a look at the programming of 8085 Microprocessor.

Instruction sets are instruction codes to perform some task. It is classified


into five categories.

S.No. Instruction & Description

Control Instructions

1
Following is the table showing the list of Control instructions with their
meanings.

Logical Instructions

2 Following is the table showing the list of Logical instructions with their
meanings.

Branching Instructions

3 Following is the table showing the list of Branching instructions with their
meanings.
Arithmetic Instructions

4 Following is the table showing the list of Arithmetic instructions with their
meanings.

Data Transfer Instructions

5 Following is the table showing the list of Data-transfer instructions with


their meanings.

8085 – Demo Programs


Now, let us take a look at some program demonstrations using the above
instructions −

Adding Two 8-bit Numbers


Write a program to add data at 3005H & 3006H memory location and store
the result at 3007H memory location.

Problem demo −
(3005H) = 14H
(3006H) = 89H

Result −

14H + 89H = 9DH

The program code can be written like this −

LXI H 3005H : "HL points 3005H"

MOV A, M : "Getting first operand"

INX H : "HL points 3006H"

ADD M : "Add second operand"

INX H : "HL points 3007H"

MOV M, A : "Store result at 3007H"

HLT : "Exit program"

Exchanging the Memory Locations


Write a program to exchange the data at 5000M& 6000M memory location.

LDA 5000M : "Getting the contents at5000M location into accumulator"

MOV B, A : "Save the contents into B register"

LDA 6000M : "Getting the contents at 6000M location into accumulator"


STA 5000M : "Store the contents of accumulator at address 5000M"

MOV A, B : "Get the saved contents back into A register"

STA 6000M : "Store the contents of accumulator at address 6000M"

Arrange Numbers in an Ascending Order


Write a program to arrange first 10 numbers from memory address 3000H
in an ascending order.

MVI B, 09 :"Initialize counter"

START :"LXI H, 3000H: Initialize memory pointer"

MVI C, 09H :"Initialize counter 2"

BACK: MOV A, M :"Get the number"

INX H :"Increment memory pointer"

CMP M :"Compare number with next number"

JC SKIP :"If less, don’t interchange"

JZ SKIP :"If equal, don’t interchange"

MOV D, M

MOV M, A

DCX H

MOV M, D

INX H :"Interchange two numbers"

SKIP:DCR C :"Decrement counter 2"

JNZ BACK :"If not zero, repeat"

DCR B :"Decrement counter 1"

JNZ START

HLT :"Terminate program execution"

Instruction Word Size in Intel 8085


microprocessor
Instruction Format - Programming
of 8085 Processor
An instruction is a command to the microprocessor to perform a given task on a specified
data. Each instruction has two parts: one is task to be performed, called the operation code
(opcode), and the second is the data to be operated on, called the operand.

PROGRAMMING OF 8085 PROCESSOR

Instruction and Data Format

An instruction is a command to the microprocessor to perform a given task


on a specified data. Each instruction has two parts: one is task to be performed,
called the operation code (opcode), and the second is the data to be operated on,
called the operand. The operand (or data) can be specified in various ways. It may
include 8-bit (or 16-bit) data, an internal register, a memory location, or 8-bit (or
16-bit) address. In some instructions, the operand is implicit.

Instruction word size

The 8085 instruction set is classified into the following three groups
according to word size:

 One-word or 1-byte instructions


 Two-word or 2-byte instructions

 Three-word or 3-byte instructions
In the 8085, "byte" and "word" are synonymous because it is an 8-bit
microprocessor. However, instructions are commonly referred to in terms of
bytes rather than words.

1 One-Byte Instructions

A 1-byte instruction includes the opcode and operand in the same byte.
Operand(s) are internal register and are coded into the instruction

These instructions are 1-byte instructions performing three different tasks.


In the first instruction, both operand registers are specified. In the second
instruction, the operand B is specified and the accumulator is assumed. Similarly,
in the third instruction, the accumulator is assumed to be the implicit operand.
These instructions are stored in 8- bit binary format in memory; each requires one
memory location.

MOV rd, rs

rd  rs copies contents of rs into rd.


Coded as 01 ddd sss
where ddd is a code for one of the 7 general registers which is the destination of
the data, sss is the code of the source register.

Example: MOV A,B

Coded as 01111000 = 78H = 170 octal (octal was used extensively in instruction
design of such processors).

ADD r

AA+r

2 Two-Byte Instructions

In a two-byte instruction, the first byte specifies the operation code and the
second byte specifies the operand. Source operand is a data byte immediately
following the opcode. For example:

Table 2.2 Example for 2 byte Instruction

The instruction would require two memory locations to store in memory.


MVI r,data

r  data

Example: MVI A,30H coded as 3EH 30H as two contiguous bytes.

This is an example of immediate addressing.

ADI data

A  A + data

OUT port

0011 1110

DATA

Where port is an 8-bit device address. (Port)  A.

Since the byte is not the data but points directly to where it is located this is called
direct addressing.

3 Three-Byte Instructions

In a three-byte instruction, the first byte specifies the opcode, and the
following two bytes specify the 16-bit address. Note that the second byte is the
low-order address and the third byte is the high-order address.

opcode + data byte + data byte


Table 3.3 Example for 3 byte Instruction

This instruction would require three memory locations to store in memory.

Three byte instructions - opcode + data byte + data byte

LXI rp, data16

rp is one of the pairs of registers BC, DE, HL used as 16-bit registers. The two
data bytes are 16-bit data in L H order of significance.

rp  data16

LXI H,0520H coded as 21H 20H 50H in three bytes. This is also immediate
addressing.

LDA addr

A  (addr) Addr is a 16-bit address in L H order.

Example: LDA 2134H coded as 3AH 34H 21H. This is also an example of direct
addressing.
Instruction Set and Format
The instruction set of the 8085 microprocessor as mentioned before consists of 74
instructions with 246 different bit patterns and all these instructions can be broadly
classified into five functional groups depending upon the operations that they can perform.
These functional groups are: data transfer (or copy)
operations; arithmetic operations; logic operations; branching operations; and machine-
control operations.

Let us see the operations that the various instructions of each of these functional groups
are capable of performing:

(i) Data transfer (or copy) operations: data transfer is more of a misnomer for such
instructions since these instructions copy data (and not transfer them) from one location
called the source to another location called the destination without affecting the contents
of the source location. Data transfer operations can further be classified into five
different types. They are:

(a) Transfer of data between registers: example is the instruction MOV B,C which copies
data from register C into register B.

(b) Placing of specific data byte into a register or a memory location: example is the
instruction MVI B, 67H (or MVI M, 4FH) which places the data byte 67H (or the data
byte 4FH) into the register B (or the memory location M whose address is contained in
the register pair HL).

(c) Transfer of data between a memory location and a register: example is the
instruction LDA 2005H which copies data from a memory location having the
address 2005H into the accumulator.

(d) Transfer of data between and I/O device and the accumulator: example is the
instruction IN 4BH which copies data from an input device having port address 4BH into
the accumulator.

(e) Transfer of data between a register pair and the stack: example is the
instruction PUSH B which places the two data bytes from register pair BCinto the user
defined memory locations called the stack.

(ii) Arithmetic operations: instructions falling under this category perform arithmetic operations such
as addition, subtraction, increment (by one) and decrement (by one).

(a) For addition any 8-bit number (for example by using the instruction ADI 8-bit), or the contents of a
register (using the instruction ADD R) or of a memory location (using the instruction ADD M) can be
added to the contents of the accumulator and the sum is stored in the accumulator. It is to be noted that
no two 8-bit registers can be added directly such as adding the contents of register B with that of
register D is not permissible. However, you will see later that the instruction DAD Rp (where Rp stands
for register pair) is an exception to this rule. It is used for the addition of two 16-bit data directly in
register pairs.

(b) Like addition even for subtraction any 8-bit number (for example by using the instruction SUI 8-bit),
or the contents of a register (using the instruction SUB R) or of a memory location (using the
instruction SUB M) can be subtracted from the contents of the accumulator and the difference is stored
in the accumulator. The subtraction is performed by the 2’s complement method and the difference if
negative is expressed in the 2’s complement form. Again direct subtraction of two registers not involving
the accumulator is not permissible. The accumulator has to be the minuend in all subtractions.
(c) For increment or decrement the 8-bit contents of a register (using the instruction INR R or DCR R)
or of a memory location (using the instruction INR M or DCR M) can be incremented or decremented
by 1. Moreover, the 16-bit data of a register pair (such as BC, DE, HL or SP) can also be incremented
or decremented by 1 using the instructions INX Rp or DCX Rp respectively.

(iii) Logic operations: instructions under this category perform various logical operations
with the contents of the accumulator such as:

(a) OR, AND, XOR: any 8-bit number (using the instructions ORI 8-bit, ANI 8bit, XRI 8-
bit), or the contents of a register/memory location (using the instructions ORA R/M, ANA
R/M, XRA R/M) can be logically ORed, ANDed, or Exclusively-ORed with the contents of
the accumulator and the result is stored in the accumulator.

(b) Rotate: each bit in the accumulator can be shifted one position to the left (using the
instruction RLC) or to the right (using the instruction RRC).

(c) Compare: any 8-bit number or the contents of a register/memory location (using
instructions like CPI 8-bit and CMP R/M) can be compared for greater than, less than or
equality with the contents of the accumulator.

(d) Complement: the accumulator contents can be complemented (that is performing the
NOT operation, logical inversion) using the instructionCMA where all 1s are replaced by 0s
and vice-versa.

(iv) Branching operations: instructions belonging to this group change the sequence of
program execution either unconditionally or after testing a certain condition. Following are
the two types of branching operations:

(a) Jump: there are unconditional (like JMP) as well as conditional Jump instructions
(like JC and JNC) that alter the program sequence within the main program either
unconditionally or conditionally (depending on the status of a flag).

(b) Call, Return and Restart: such instructions alter the program sequence either by
calling a subroutine (or restarting at a service routine) or by returning to the main program
from a subroutine. Both the Call and the Return operations have unconditional as well as
conditional instructions such as CALL 16-bit, CNC 16-bit, RET and RNC. Details about these
instructions and others of such type are discussed later.

(v) Machine control operations: instructions of this category basically control the machine
functions such as HLT (indicating the end of program) and NOP(indicating no operation to
be performed by the computer).

We will again be returning to the these five categories of operations and discussing the
instructions belonging to each of these categories in much greater detail, but before we
do that we need to get a fair idea about the way instructions are designed and formatted.
As was mentioned earlier an instruction is a command to the microprocessor to carry out
a task on some data. This means that an instruction should have two parts in it: one
should be the task (or the operation) to be performed and the other should be the data
on which the operation is to be performed. Let us call the first part as opcode (short for
operation code) and the second as operand. The operand (that is the data) can be specified
directly as an 8-bit or a 16-bit data or indirectly through a register or a register pair or a
memory location. Sometimes the operand is implicit in the opcode (that is included in
the opcode itself). Now depending on the word size the instructions of the 8085
microprocessor are classified into three categories: 1-byte, 2-byte, and 3-byte
instructions.
(a) 1-byte instructions: a 1-byte instruction includes both the operation as well as the data
in a single byte called the opcode. Such instructions need one memory location to store in
the user memory. Given below are a few examples of such instructions:

Instruction Operation Operand Hex-code

MOV B,A Move content Data specified through 47H (opcode for the
of A intoB. register A. instruction)

DCR B Decrement content Data specified through 05H (opcode for the
ofB by 1. register B. instruction)

CMA Complement the Data specified through 2FH (opcode for the
content of A. register A (implicit instruction)
inCMA).

(b) 2-byte instructions: in a 2-byte instruction the first byte is always the opcode of
the instruction and the second byte a data byte. Such instructions need two memory
locations to store in the user memory. Given below are a few examples of such
instructions:

Instruction Operation Operand Hex-code

MVI B,8-bit Move immediate 8- 8-bit data is specified 06H (opcode for the
bitdata into B. as the second byte of instruction)
the instruction.

ADI 8-bit Add immediate 8- 8-bit data is specified C6H (opcode for the
bitdata with content as the second byte of instruction)
of A. Store the sum in the instruction.
A.

(c) 3-byte instructions: in a 3-byte instruction the first byte is always the opcode of the
instruction and the second and third bytes are data bytes. The second byte is the lower
order data byte and the third byte is the higher order data byte of a 16-bit data (generally
a 16-bit address of a memory location). Such instructions need three memory locations to
store in the user memory. Given below is an example of such instructions:

Instruction Operation Operand Hex-code

JMP 16-bit Jump to memory 16-bit data (memory C3H (opcode for the
location having address) is specified instruction)
the16-bit memory as the second byte
address. (lower order byte of
the address) and
third byte (higher
order byte of the
address) of the
instruction.

Now let us see how instructions are formatted in the 8085 microprocessor that is
how opcodes are designed. All registers, register pairs and operations have been given
specific binary codes. Given below are some of these codes:

Register Code

B 000

C 001

D 010

E 011

H 100

L 101

A 111

Register Pair Code

BC 00

DE 01

HL 10

Operation Code Comment

Rotate each bit of accumulator by 00000111 The operation has an 8-bit code.
one position to the left.

Add the contents of a register to that 10000sss The operation ADD has a 5-bit
of the accumulator. code 10000. The 3 bits sss are
reserved for the code of a
register.

Move the contents of the source 01dddsss The operation MOVE has a 2-bit
register Rs to the destination register code 01. The 3 bits ddd are
Rd. reserved for the code of
destination register Rd and the 3
bits sss are reserved for the
code of source register Rs.

As an example let us see how the opcodes for various ADD and MOVE instructions are
designed:

Mnemonic ADD B ADD H MOV C,A MOV D,E


Binary instruction 10000 000 10000 100 01 001 111 01 010 011
(Opcode)

Hex Code (Opcodein 80H 84H 4FH 53H


hexadecimal)

Now with the knowledge on the instructions of the 8085 microprocessor that we have
gained till now we are in a position to understand and write simple and basic programs in
its assembly language. A program in general is a sequence of instructions that tells the
computer to perform a particular task. In the assembly language program the instructions
are to be chosen from the instruction set of the 8085 microprocessor. Let us suppose that
we want to write a simple program to add two bytes of data (say 45H and A3H) and store
the sum in register H. The logical steps required for performing this task should be:

(i) Load 45H in the accumulator.

(ii) Load A3H in some other register say register B.

(iii) Add the contents of register B to that of the accumulator.

(iv) Store the answer in register H.

(v) Halt the program.

Let us see how these steps can now be translated into an assembly language program
which can then be loaded into the user memory for execution

Mnemonics Comments User Memory Hex Code


Location

MVI A,45H Load 45H in the 2000H 3EH


accumulator.
2001H 45H

MVI B,A3H Load A3H in register B. 2002H 06H

2003H A3H

ADD B Add the contents of 2004H 80H


register B to that of the
accumulator. Result is
stored in the
accumulator.

MOV H,A Move the result in 2005H 67H


register H.

HLT Halt the program. 2006H 76H

For running the program in a computer we need to first look up for the opcode for each
instruction in the instruction set given in the manual of the 8085 microprocessor. Once we
have written the program with all the hex codes in proper sequence (matching one to one
with the mnemonics) we can then load the program in the user memory sequentially
starting preferably with its first memory location (2000H in the above example). After the
program has been loaded in the user memory execution should begin from the first
memory location. Initially the first hex code (which will be the opcode of the first
instruction) will be fetched by the microprocessor from the user memory, decoded and
then finally the appropriate action will be executed. This cycle of fetch-decode-execute will
then carry on sequentially, one instruction after the other, till the microprocessor
encounters the halt instruction.

8085 Addressing Modes & Interrupts


Now let us discuss the addressing modes in 8085 Microprocessor.

Addressing Modes in 8085


These are the instructions used to transfer the data from one register to
another register, from the memory to the register, and from the register
to the memory without any alteration in the content. Addressing modes in
8085 is classified into 5 groups −

Immediate addressing mode


In this mode, the 8/16-bit data is specified in the instruction itself as one
of its operand. For example: MVI K, 20F: means 20F is copied into
register K.

Register addressing mode


In this mode, the data is copied from one register to another. For
example:MOV K, B: means data in register B is copied to register K.

Direct addressing mode


In this mode, the data is directly copied from the given address to the
register. For example: LDB 5000K: means the data at address 5000K is
copied to register B.

Indirect addressing mode


In this mode, the data is transferred from one register to another by using
the address pointed by the register. For example: MOV K, B: means data
is transferred from the memory address pointed by the register to the
register K.

Implied addressing mode


This mode doesn’t require any operand; the data is specified by the opcode
itself. For example: CMP.
Interrupts in 8085
Interrupts are the signals generated by the external devices to request the
microprocessor to perform a task. There are 5 interrupt signals, i.e. TRAP,
RST 7.5, RST 6.5, RST 5.5, and INTR.

Interrupt are classified into following groups based on their parameter −

 Vector interrupt − In this type of interrupt, the interrupt address is known


to the processor. For example: RST7.5, RST6.5, RST5.5, TRAP.

 Non-Vector interrupt − In this type of interrupt, the interrupt address is not


known to the processor so, the interrupt address needs to be sent externally
by the device to perform interrupts. For example: INTR.

 Maskable interrupt − In this type of interrupt, we can disable the interrupt


by writing some instructions into the program. For example:RST7.5, RST6.5,
RST5.5.

 Non-Maskable interrupt − In this type of interrupt, we cannot disable the


interrupt by writing some instructions into the program. For example: TRAP.

 Software interrupt − In this type of interrupt, the programmer has to add


the instructions into the program to execute the interrupt. There are 8
software interrupts in 8085, i.e. RST0, RST1, RST2, RST3, RST4, RST5, RST6,
and RST7.

 Hardware interrupt − There are 5 interrupt pins in 8085 used as hardware


interrupts, i.e. TRAP, RST7.5, RST6.5, RST5.5, INTA.

Note − NTA is not an interrupt, it is used by the microprocessor for


sending acknowledgement. TRAP has the highest priority, then RST7.5 and
so on.

Interrupt Service Routine (ISR)


A small program or a routine that when executed, services the
corresponding interrupting source is called an ISR.

TRAP
It is a non-maskable interrupt, having the highest priority among all
interrupts. Bydefault, it is enabled until it gets acknowledged. In case of
failure, it executes as ISR and sends the data to backup memory. This
interrupt transfers the control to the location 0024H.
RST7.5
It is a maskable interrupt, having the second highest priority among all
interrupts. When this interrupt is executed, the processor saves the
content of the PC register into the stack and branches to 003CH address.

RST 6.5
It is a maskable interrupt, having the third highest priority among all
interrupts. When this interrupt is executed, the processor saves the
content of the PC register into the stack and branches to 0034H address.

RST 5.5
It is a maskable interrupt. When this interrupt is executed, the processor
saves the content of the PC register into the stack and branches to 002CH
address.

INTR
It is a maskable interrupt, having the lowest priority among all interrupts.
It can be disabled by resetting the microprocessor.

When INTR signal goes high, the following events can occur −

 The microprocessor checks the status of INTR signal during the execution of
each instruction.

 When the INTR signal is high, then the microprocessor completes its current
instruction and sends active low interrupt acknowledge signal.

 When instructions are received, then the microprocessor saves the address of
the next instruction on stack and executes the received instruction.

Timing Diagrams of 8085


It is one of the best way to understand to process of micro-processor/controller. With the help of
timing diagram we can understand the working of any system, step by step working of each
instruction and its execution, etc.

It is the graphical representation of process in steps with respect to time. The timing diagram
represents the clock cycle and duration, delay, content of address bus and data bus, type of
operation ie. Read/write/status signals.
Important terms related to timing diagrams:

1. Instruction cycle: this term is defined as the number of steps required by the cpu to
complete the entire process ie. Fetching and execution of one instruction. The fetch and
execute cycles are carried out in synchronization with the clock.
2. Machine cycle: It is the time required by the microprocessor to complete the operation
of accessing the memory devices or I/O devices. In machine cycle various operations like
opcode fetch, memory read, memory write, I/O read, I/O write are performed.
3. T-state: Each clock cycle is called as T-states.

Rules to identify number of machine cycles in an instruction:


1. If an addressing mode is direct, immediate or implicit then No. of machine cycles = No. of
bytes.

2. If the addressing mode is indirect then No. of machine cycles = No. of bytes + 1. Add +1 to the
No. of machine cycles if it is memory read/write operation.

3. If the operand is 8-bit or 16-bit address then, No. of machine cycles = No. of bytes +1.

4. These rules are applicable to 80% of the instructions of 8085.

Timing Diagram:

Where, Instruction cycle= Fetch Cycle(FC) + Executecycle(EC).

Opcode fetch:
 The microprocessor requires instructions to perform any particular action. In order to
perform these actions microprocessor utilizes Opcode which is a part of an instruction which
provides detail(ie. Which operation µp needs to perform) to microprocessor.
Fig: Opcode fetch timing diagram

Operation:
 During T1 state, microprocessor uses IO/M(bar), S0, S1 signals are used to instruct
microprocessor to fetch opcode.

 Thus when IO/M(bar)=0, S0=S1= 1, it indicates opcode fetch operation.

 During this operation 8085 transmits 16-bit address and also uses ALE signal for address
latching.

 At T2 state microprocessor uses read signal and make data ready from that memory
location to read opcode from memory and at the same time program counter increments by 1
and points next instruction to be fetched.

 In this state microprocessor also checks READY input signal, if this pin is at low logic
level ie. '0' then microprocessor adds wait state immediately between T2 and T3.

 At T3, microprocessor reads opcode and store it into instruction register to decode it
further.

 During T4 microprocessor performs internal operation like decoding opcode and providing
necessary actions.

 The opcode is decoded to know whether T5 or T6 states are required, if they are not
required then µp performs next operation.
Read and write timing diagram for memory and I/O
Operation

Memory Read:

<>Figure: Memory read timing diagram

Operation:
 It is used to fetch one byte from the memory.

 It requires 3 T-States.

 It can be used to fetch operand or data from the memory.

 During T1, A8-A15 contains higher byte of address. At the same time ALE is high.
Therefore Lower byte of address A0-A7 is selected from AD0-AD7.

 Since it is memory ready operation, IO/M(bar) goes low.

 During T2 ALE goes low, RD(bar) goes low. Address is removed from AD0-AD7 and data
D0-D7 appears on AD0-AD7.

 During T3, Data remains on AD0-AD7 till RD(bar) is at low signal.

Memory Write:
Figure: Memory write timing diagram

Operation:
 It is used to send one byte into memory.

 It requires 3 T-States.

 During T1, ALE is high and contains lower address A0-A7 from AD0-AD7.

 A8-A15 contains higher byte of address.

 As it is memory operation, IO/M(bar) goes low.

 During T2, ALE goes low, WR(bar) goes low and Address is removed from AD0-AD7 and
then data appears on AD0-AD7.

 Data remains on AD0-AD7 till WR(bar) is low.

IO Read:
Figure: I/O read timing diagram

Operation:

It is used to fetch one byte from an IO port.

It requires 3 T-States.

During T1, The Lower Byte of IO address is duplicated into higher order address bus A8-A15.

ALE is high and AD0-AD7 contains address of IO device.

IO/M (bar) goes high as it is an IO operation.

During T2, ALE goes low, RD (bar) goes low and data appears on AD0-AD7 as input from IO
device.

During T3 Data remains on AD0-AD7 till RD(bar) is low.

IO Write:
Figure:I/O write timing diagram

Operation:

 It is used to writ one byte into IO device.

 It requires 3 T-States.

 During T1, the lower byte of address is duplicated into higher order address bus A8-A15.

 ALE is high and A0-A7 address is selected from AD0-AD7.

 As it is an IO operation IO/M (bar) goes low.

 During T2, ALE goes low, WR (bar) goes low and data appears on AD0-AD7 to write data
into IO device.

 During T3, Data remains on AD0-AD7 till WR(bar) is low.

You might also like