unit-4_CA_updated_Notes
unit-4_CA_updated_Notes
The computer’s Central Processing Unit (CPU) built on a single Integrated Circuit
(IC) is called a microprocessor.
Micro computer:
This diagram represents a traditional CPU setup where the main components are
separated.
1. Arithmetic /Logic unit (ALU): It is responsible for performing arithmetic and
logical operations.
2. Control unit: Manages the execution of instructions by controlling data flow.
3. Memory: Stores instructions and data that are processed by the CPU.
4. Input and Output: Handles communication between the CPU and external
devices.
Components of a Microprocessor
A microprocessor consists of various components that work together to execute
instructions:
1. Arithmetic Logic Unit (ALU): This is the component responsible for performing
arithmetic (addition, subtraction, multiplication, division) and logical
operations (AND, OR, NOT) The ALU is the computational heart of the
microprocessor.
2. Control Unit: The control unit manages the execution of instructions by directing
the flow of data between the microprocessor, memory, and I/O devices.
3. Registers: Registers are small, fast storage locations within the CPU. They are
used to temporarily hold data, instructions, or addresses during execution.
Registers are much faster than external memory like RAM.
* Data Registers: Hold intermediate results or operands for calculations.
* Address Registers: Hold memory addresses for instructions or data.
* Program Counter (PC): Keeps track of the next instruction to execute.
* Stack Pointer (SP): Points to the top of the stack, which is used for function
calls and handling interrupts.
4. Buses: The microprocessor communicates with memory and 1/0 devices through
buses These are electrical pathways used to transmit data, addresses, and control
signals.
o Data Bus: Carries the actual data being processed.
o Address Bus: Carries the memory addresses where data is stored.
o Control Bus: Carries signals like read/write operations to control the
flow of data.
Evolution of Microprocessor:
The first generation microprocessors were introduced in the year 1971-1972 by
Intel Corporation. It was named Intel 4004 since it was a 4-bit processor.
The second generation microprocessors were introduced in 1973 again by Intel.
It was a first 8 - bit microprocessor which could perform arithmetic and logic
operations on 8-bit words. It was Intel 8008, and another improved version was
Intel 8088.
The third generation microprocessors, introduced in 1978 were represented
by Intel's 8086, Zilog Z800 and 80286, which were 16 - bit processors with a
performance like minicomputers.
Several different companies introduced the 32-bit microprocessors, but the most
popular one is the Intel 80386.
Basic Terms used in Microprocessor
Instruction Set - The group of commands that the microprocessor can
understand is called Instruction set. It is an interface between hardware and
software.
Bus - Set of conductors intended to transmit data, address or control
information to different elements in a microprocessor. A microprocessor will
have three types of buses, i.e., data bus, address bus, and control bus.
IPC (Instructions per Cycle) - It is a measure of how many instructions a CPU is
capable of executing in a single clock.
Clock Speed - It is the number of operations per second the processor can
perform. It can be expressed in megahertz (MHz) or gigahertz (GHz). It is also
called the Clock Rate.
Bandwidth - The number of bits processed in a single instruction is called
Bandwidth.
Word Length - The number of bits the processor can process at a time is called
the word length of the processor. 8-bit Microprocessor may process 8 -bit data
at a time. The range of word length is from 4 bits to 64 bits depending upon the
type of the microcomputer.
Data Types - The microprocessor supports multiple data type formats like
binary, ASCII, signed and unsigned numbers.
Features of a Microprocessor:
High Speed: They execute instructions rapidly, enabling quick processing of data
and tasks.
Small Size: Microprocessors are compact, allowing them to fit into a variety of
devices and systems.
Versatile: They can be programmed to perform a wide range of functions,
making them suitable for diverse applications.
Low Power Consumption: Designed to operate efficiently, microprocessors
consume minimal power, extending battery life and reducing energy costs.
Less Heat Generation: They produce less heat compared to older technologies,
minimizing the need for extensive cooling solutions.
Reliable: Microprocessors offer consistent performance and durability,
contributing to the overall stability of electronic systems.
Portable: Their small size and low power requirements make them ideal for use
in portable and mobile devices.
8-bit Data Width: The 8085 can handle data in 8-bit chunks. It is suitable for
simple and small-scale computing tasks.
16-bit Address Bus: It can access up to 64KB of memory. This memory capacity
was sufficient for most early computing and control applications. • Clock Speed:
The 8085 operates at a clock speed of up to 3.2 MHZ. It provided fast
performance in that period.
5V Power Supply: The microprocessor operates using a single 5V power supply.
This makes it easy to power and integrate into various systems.
74 Instructions: The instruction set includes 74 instructions. These cover data
transfer, arithmetic, logic, branching, and control operations. The 8085 is an 8-bit
device and hence it can have up to 28 = 256 instructions. However, the 8085 only
uses 246 combinations that represent a total of 74 instructions.
Multiplexed Address/Data Bus: The 8085 uses a multiplexed bus for both
address and data. This helps to reduce the number of external pins required. The
term multiplexed bus refers to using the same set of lines (or wires) to carry both
address and data at different times.
Internal Registers: It contains six 8-bit registers (B, C, D, E, H, L), a 16-bit stack
pointer, and a 16-bit program counter for efficient operation.
Interrupt System: The 8085 has five hardware interrupts. This allows fast
responses to external events.
1. Register Array:
General purpose Registers: The 8085 has 6 general purpose registers to store 8-bit
data during program execution. These 6 registers are identified as B, C, D, E, H and L.
They can be combined as register pairs BC, DE and HL to perform some 16-bit
operations. These registers are programmable. It can use to load or transfer data from
the registers by using instructions.
Stack Pointer (SP): The stack pointer is also a 16-bit register, used as a memory
pointer. It points to a memory location in R/W memory, called stack. The stack is used
to store return addresses during subroutine calls, as well as local variables and other
data.
Program counter: It is a 16-bit register used to store the memory address location of
the next instruction to be executed.
Incrementer / Decrementer address latch: This 16-bit register is used to increment or
decrement the contents of program counter or stack pointer.
Carry Flag (C): Set if there is a carry or borrow during arithmetic operations.
Zero Flag (Z): Set if the result of an operation is 00H in Accumulator register.
Sign Flag (S): S=1 if D7 bit of the A is 1(indicate the result is - ve)
S= 0 if D7 bit of the A is 0(indicate the result is +ve)
Parity Flag (P): P= 1; if the result of an ALU operation has an even number of 1’s in A;
P= 0; if number of 1 is odd.
Auxiliary Carry Flag (AC): Similar to CY,
AC= 1 if there is a carry from D3 to D4 Bit
AC= 0 if there is a no carry from D3 to D4 Bit
Operation S1 S0
HALT 0 0
WRITE 0 1
READ 1 0
FETCH 1 1
Control Pins
READY: It checks if a peripheral device is ready to communicate with the
microprocessor. If not, the microprocessor waits.
HOLD: It is used to indicate that an external device is requesting control of the bus
HLDA (Hold Acknowledge): It is used to acknowledge a HOLD request.
RESET IN: It is used to reset the microprocessor and start the program execution from the
beginning.
RESET OUT: It indicates to external devices that the microprocessor has been reset.
CLK OUT: It provides the clock signal for external devices.
XTAL1 and XTAL2: These pins are used to connect an external crystal oscillator that
provides the clock signal for the microprocessor.
VCC: It is used to provide a 5V power supply to the microprocessor.
GND: It is the Ground Pin.
Programming model of 8085:
1. Arithmetic and Logic Unit (ALU): The ALU is where the microprocessor performs
all arithmetic (Addition, subtraction) and logical (AND, OR, NOT) operations.
Accumulator: The Accumulator is an 8-bit register. It stores the Intermediate
results of Arithmetic and Logical operations. It holds first operand of ALU
Operations and the final result of ALU operations is also placed in the
accumulator.
Flags: The flag register consists of 5 flip-flops that reflect the outcome of ALU
operations. These flags are Zero (Z), Sign (S), Carry (CY), Parity (P), and Auxiliary
Carry (AC). Ex example: if the result of an addition is ZERO, the Zero flag is set.
Instruction Decoder: The instruction decoder decodes the instructions fetched
from memory. It identifies what operations perform and sends controls signals to
appropriate components of the microprocessor.
2. Register section: This section contains the General Purpose registers, Stack
pointer and Program counter. These registers store data and addresses
temporarily while the micro processor is performing operations.
Register array: The 8085 has six 8-bit general purpose registers (B, C, D, E, H, L ) .
These registers are used to store data temporarily and can be combined to from
register pairs (BC, DE, and HL) to handle 16-bit data.
Memory pointer Register: This includes the Program counter (PC) and Stack
pointer (SP) which are 16-bit registers. The PC holds the memory address of the
next instruction to be executed. The SP points to the top of the stack in memory,
the stack is used to store return addresses during subroutine calls or Interrupts.
3. Timing and Control Unit: It is used to generate the timing and control signals
which are necessary for the execution of instructions. It is used to control the
data flow between the CPU and peripherals (Including Memory).it is used to
control the entire operations of the micro processor and peripherals connected
to it.
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
4. Buses: Buses are used to Transfer data, address and control signals between the
micro processor and the other components.
16-bit address Bus: This is unidirectional bus that carries the 16 bit memory
address from the microprocessor to memory or I/O devices.
8-bit address Bus: This is a bidirectional bus that transfers 8 bits of data
between the microprocessor and memory or I/O devices.
The 8085 Micro processor is an 8 bit micro processor and it can handles 8
bit data at a time. If 16 bit data are to stored, they are stored they are
stored in two consecutive Memory locations. The Micro processor
understands the instructions written in binary codes or machine codes.
According to the word length the 8085 instructions are belongs to the one
of the following three groups.
1. One Byte instructions
2. Two Byte instructions
3. Three Byte instructions
One Byte instructions: A 1- Byte Instruction includes the op code and
operand in the same type. Operands are internal register and are coded
into the instruction. This instruction requires one memory location to store
Single byte in Memory.
Ex:
Memory Op Code Operand Hex Task
Address Code
8000H MOV C,A 4FH Copy the content of the
accumulator in the register C.
8001H ADD B 80H Add the content of register B
to the Contents of the
Accumulator.
8002H CMA 2FH Invert (Compliment) each bit
in the accumulator.
Assume that the Data byte is 32H. The assembly Language instruction is written as
Note: The hex code of MVI A is stored in 8000H memory location and the data 32H is
stored 8001H memory location. Thus the 2-byte instructions require two memory
locations to store in memory.
Ex:
Memory Op Operand Hex Code Task
Address Code
8000H, JMP 2050H C3 (first Byte) Transfer the program
8001H, 50 (Second Byte) sequence to the memory
8002H 20 (Third Byte) location 2050H.
8000H, LXIH 2500H 21 (first Byte) Initialize the memory
8001H, 00 (Second Byte) pointer by HL register
8002H 25 (Third Byte) pair.
Instruction Classification of 8085:
An instruction is a binary pattern used by the microprocessor to perform a specific
function. The complete set of instructions that a microprocessor can execute is called the
instruction set.
The instructions are categorized in two ways.
1. Instruction Classification of 8085 based on Functions
2. Instruction Classification of 8085 based on Word Length
Instruction Classification of 8085 based on Functions:
The primary Categories are
1. Data Transfer Instructions
2. Arithmetic operations
3. Logical operations
4. Branching operations
5. Machine Control operations
Data Transfer instructions:
In 8085 microprocessor, data transfer instructions are used to move data between
registers, memory, and I/O ports. These operations allow data to be copied from one
location to another without modifying the contents of the original location.
➢ MOV Data Between Registers and Memory
1.Mov Rd and Rs
This instruction transfers the contents of the source register (Rs) to the destination
register (Rd) without modifying the contents of the source register. Both Rs and Rd can
be any general-purpose registers or the accumulator (B, C, D, E, H, L or A). Since
there are 7 registers, there are a total of 49 combinations of MOV instructions for
transferring data between any two registers. The Possible combinations of MOV
instructions are:
MOV A, B MOV B, A MOV C, A MOV E, B
Ex: MOV B, C
The instruction MOV B, C will copy the contents of C register to register B. The
contents of register B and C before and after execution of the instruction is:
Register Before After
Execution Execution
B 3A 52
C 52 52
2. MOV Rd, M
• This instruction is used to transfer data from a memory location, which is addressed by
the HL register pair, to another register.
• The HL register pair holds the address of the memory location, it contains the
operand(data) that can be moved Specified destination Register (Rd).
Ex: MOV D, M
The HL register pair holds the memory location 8500H. Assume that contents of H and L
are 85 and 00. The contents of the memory location are 23. The MOV D, M instruction
transfers this data (23) to register D.
3. MOV M, Rs
The instruction MOV M, Rs is used to copy the data from specified source register (Rs)
in to the memory location pointed by the HL register pair. The HL register pair is used as
a pointer to determine the specific memory location where the data will be stored. Rs can
be any one of the general-purpose registers or the accumulator.
Ex: MOV M, B
The HL register pair holds the memory location 8050H.Assume the contents of register H and L
are 80 and 50. The contents of the register B (34) is moved to the Memory location.
The instruction STAX D, which stores the content of the accumulator into the
memory location pointed by DE register pair.DE register contains 8050H memory
location and accumulator contains 7A. 7A stored in to 8050H memory location.
➢ Load and Store H and L Registers:
In the 8085 Microprocessor, Load and Store H and L Registers instructions
are used to move the data between the memory and the HL register pair.
1. LHLD 16-bit Address: (Load H and L direct)
The Instruction LHLD 16-bit address is used to load the content of two
consecutive memory locations into the register pair. It directly transfers
data from a memory location to the H and L registers.
Ex: LHLD 3050H
In this example the instruction loads data from memory locations 3050H
(23) and the data from the next memory location 3051H (45) into
registers L and H respectively. Now the HL register pair contains 2345.
The L gets the lower byte and H gets the higher byte.