ch-1
ch-1
Memory
Working
• The microprocessor follows a sequence: Fetch, Decode and then Execute.
• The instructions are stored in a sequential order. The microprocessor
fetches those instructions from memory, then decodes it and executes
those instructions till stop instruction is reached.
• It sends the results in binary to the output port.
• Between these processes, the register stores the temporarily data and ALU
performs the computing functions.
Name Word length Addressing Number of pins
capacity
4004 4 bits 640 bytes 16
8008 8 bits 16kb 18
8080 8 bits 64kb 40
8085 8bits 64kb 40
8086 16 bits 1Mb 40
Terms used in Microprocessor
• Instruction set- it is the set of instruction that microprocessor
understand.
• Bandwidth- it is the number of bits processed in a single instruction.
• Clock speed- it determines the number of operations per second the
processor can perform. Eg Mhz, Hz.
• Word length- it depends upon width of internal data bus, registers,
ALU, etc. An 8-bit microprocessor can process 8 bit data at a time.
• Data type- the microprocessor has multiple data type formats like
binary, BCD, ASCII, signed and unsigned number.
Features of Microprocessor:-
• Cost Effective :- the microprocessor chips are available at low prices
and results its low cost.
• Size:- the microprocessor is a small chip size, hence it is portable.
• Low power consumption :- manufactured by semiconductor
technology, which has low power consumption.
• Versatility :- the microprocessors are versatile as we use the same
chips in number of applications by configuring the software program.
• Reliability :- the failure rate of an IC in microprocessors is very low,
hence it is reliable.
BUS
• The communication channel between the microprocessor and
peripherals is known as bus. It is a just group of wires.
• All the peripherals share the same bus but the microprocessor
communicates with only one peripheral at one time as per the timing
provided by the control unit.
Address Bus:-
• This bus is unidirectional, i.e. bit flow in only one direction from MPU to
memory and peripherals.
• The address bus is for identification of memory locations and peripherals.
• 8085 has 16 bit and 8086 has 20 bit address bus.
Data Bus:-
• This bus is bidirectional, i.e. data can flow in both directions between
mpu and memory/ peripherals.
• 8085 has 8 data lines and 8086 has 16 data lines.
Control Bus:-
• The control lines which carry synchronization and timing signals are
known as control bus.
8085 Microprocessor
• It is an 8 bit microprocessor designed by intel using NMOS
technology.
• It has the following configurations :-
8 bit data bus.
16 bit address bus which address upto 64kb
A 16 bit program counter.
A 16 bit stack pointer.
Six 8 bit register arranged in pairs : BC, DE, HL.
Require +5v supply to operate at 3.2Mhz single clock frequency.
• It is used in washing machines, microwave, ovens, mobile phones,
etc.
Functional unit:-
• Accumulator :- it is an 8 bit register used to perform arithmetic, logical, I/O
and load, store operation. It is connected to internal data bus & ALU.
• Arithmetic & logical unit :- it performs arithmetic and logical operations like
ADD, SUB, AND, NOT, OR etc.
• General purpose register:- there are 6 general purpose register in 8085
processor i.e. B,C,D,E,H and L. each register can hold 8 bit data. These
register work in pair to hold 16 bit data like BC, DE, HL.
• 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 PC whenever the instruction is being executed so that it points the next
instructions to be executed.
• Stack pointer :- it is also 16 bit register works like a stack, which is always
incremented/ decremented by 2 during push and pop operation.
• Temporary Register:-It is an 8 bit register, which holds the temporary data of
arithmetic and logical operation.
• Flag register :- it is an 8 bit register having 1 bit fil-flops, which holds either 0
or 1 depending upon the result sotred in the AC. These are the 5 flip-flops-
Sign(S), Zero(Z), Auxiliary carry (AC), Parity(P), carry (C ).
• Instruction Register and decoder :- it is an 8 bit register. When an
instruction is fetched from the memory then it is stored in instruction
register. Instruction decoder decodes the information present in the
instruction register.
• Timing and control unit :- it provides the timing and control signals to
microprocessor to perform operations. Following are some timing and
control signals, which controls external and internal circuit.
control signal – READY, RD, WR, ALE,
status signal – S0,S1, IO/M
DMA signal – HOLD, HLDA
RESET signal – RESET IN, RESET OUT
• Interrupt :- 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.
Maskable Interrupts are those which can be disabled or ignored by the
microprocessor. INTR, RST 7.5, RST 6.5, RST 5.5 are maskable interrupts
in 8085 microprocessor.
Non-Maskable Interrupts are those which cannot be disabled or
ignored by microprocessor. TRAP is a non-maskable interrupt.
Instruction Cycle
• Time required to execute and fetch an entire instruction is
called instruction cycle. A program residing in the memory
unit of the computer consists of a sequence of instructions.
• The program is executed in the computer by going through
the cycle for each instruction. Each instructions cycle in turn
subdivided into sequence of a sub cycle. Each instructions
cycle consists of following phases :-
1. Fetches instructions from memory.
2. Decode the instruction.
3. Read the effective address from memory.
4. Execute the instruction.
• The time required by the microprocessor to complete an operation of
accessing memory or input/output device is called the machine cycle.
Following are the different types of machine cycles :-
• Opcode fetch – which takes 4t-states
• Memory read – which takes 3t-states
• Memory write – which takes 3t-states
• I/O read – which takes 3t-states
• I/O write – which takes 3t-states
• One time period of frequency of microprocessor is called t-state. T-state is
measured from the falling edge of one clock pulse to the falling edge of next
clock pulse.
Opcode fetch cycle :-
• The first machine cycle of every instruction is opcode fetch cycle in
which the 8085 finds the nature of the instruction to be executed. In
this machine cycle, processor places the contents of the Program
Counter on the address lines, and through the read process, reads the
opcode of the instruction. The length of this cycle is not fixed. It varies
from 4T states to 6T states as per the instruction.
RD¯ =0
Address Bus
AD0 –AD7 =00H after RD =0 , it contains 3H. For 1st T-state it contains
address (ALE=1)and then it contains data (ALE=0).
A8 –A15 =20H S0,S1 =opcode fetch, =1,1
IO/M =0 for memory related operation.
Memory Write Cycle :-
• The 8085 executes the memory write cycle to store the data into data
memory or stack memory. The length of this machine cycle is 3T
states. In this machine cycle, processor places the address on the
address lines from the stack pointer or general purpose register pair
and through the write process, stores the data into the addressed
memory location.
I/O Read cycle :-
• The I/O read and I/O write machine cycles are similar to the memory
read and memory write machine cycles, respectively, except that the
I0/M signal is high for I/O read and I/O write machine cycles. High
IO/M signal indicates that it is an I/O operation.
Addressing Mode in 8085 :-
• In each instruction, programmer has to specify 3 things:
• Operation to be performed.
• Address of the source data.
• Address of the destination result.
• Direct addressing mode :- the data to be operated is available inside a
memory location and that memory location is directly specified as an
operand. The operand is directly available in the instruction itself.
e.g LDA 2050 (load the contents of memory location into accumulator A)
• Register addressing mode :- In register addressing mode, the data to
be operated is available inside the register(s) and register(s) is(are)
operands.
Register indirect addressing mode :-
• The data to be operated is available inside a memory location and that
memory location is indirectly specified by a register pair. e.g. LDAX B.