Académique Documents
Professionnel Documents
Culture Documents
CS-315
Microprocessors by B. Ram
Microprocessors by Tokoheim
Digital Computer Fundamentals
by Paul Albert Malvino
Microprocessor basics
A microprocessor is a multipurpose, programmable, clock
driven, register-based electronic device that reads binary
instructions from a storage device called memory accepts
binary data as input and processes data according to
instructions, and provides result as output.
OR
When the CPU of a computer system is fabricated on a single
chip it is termed as microprocessor.
A micro-computer is a device which uses microprocessor as
its central processing unit along with other associated
peripherals like I/O and Memory devices.
A microcontroller is a device which contains CPU, few MB of
memory and few I/O devices all fabricated on a single chip
and is used for specific tasks like washing machine control etc.
Microprocessor Generations
Microprocessors are categorized into five generations:
first, second, third, fourth, and fifth generations. Their
characteristics are described below:First Generation: The microprocessors that were introduced in 1971 to
1972 were referred to as the first generation systems.
First-generation microprocessors processed their
instructions seriallythey fetched the instruction,
decoded it, then executed it. When an instruction was
completed, the microprocessor updated the instruction
pointer and fetched the next instruction, performing
this sequential drill for each instruction in turn.
Classification of Microprocessors
Microprocessors are classified on the basis of
Bit size (Word Length)
Fabrication Technology used
Bit Size
4 bit:-Intels 4004/4040/Toshiba TMS 1000/Rockwells PPS-4
8 bit:- Intels 8008/8080/8085/Zilog Z-80/Motorola M6800/Fairchilds F-8/Rockwells PPS-8
16 bit :- Intels 8086/ 8088/ Zilog 8000/ Intels
80186 80286/Motorola M68000
32 bit:- Intel 80386 / 80486 PENTIUM /PENTIUM PRO/Zilog
80000/M-68002
64 bit:- Dual core processors/Itanium/core i7 etc
Moores Law
40 years ago, Intel co-founder Gordon
Moore gave Moores Law , which
states The number of Transistors
fabricated on a single chip will double
every 18 months
Tri-State Switch
A Tri-state Switch can be thought of as an input controlled
switch with an output that can be electronically turned
ON or OFF by means of an external Control or
Enable ( EN ) signal input. This control signal can be
either a logic 0 or a logic 1 type signal resulting in
the Tri-state switch being in one state allowing its output
to operate normally producing the required output or in
another state were its output is blocked or
disconnected.
Then a tri-state switch requires two inputs. One being
the data input and the other being the enable or control
input as shown.
There are two different types of Tri-state switches, one
whose output is controlled by an Active-HIGH control
signal and the other which is controlled by an ActiveLOW control signal
It is manufactured with N-MOS (n-type Metal Oxide Semiconductor) technology implemented with 6200 transistors.
It has 16-bit address lines - A0-A15 (to point the memory locations) and hence can point up to 2^16 = 65535 bytes (64KB) memory
locations.
The first 8 lines of address bus and 8 lines of data bus are multiplexed AD0-AD7. Data bus is a group of 8 lines D0-D7.
It provides 5 level interrupts and supports external interrupt request.
6 GPRs
These GPRs are known as Scratch Pad
Registers, they are of 8 bits each. They have
designated numerical codes which are as
under: The above registers can be used in pairs
forming the following 16 bit pairs
BC
DE
HL
Their code are as under:-
Accumulator Register
Accumulator is nothing but a register which can hold 8bit data. Accumulator aids in storing two quantities.
The data to be processed by arithmetic and logic unit is
stored in accumulator.
It also stores the result of the operation carried out by
the Arithmetic and Logic unit.
The accumulator is a 8-bit register. The accumulator is
connected to Internal Data bus and ALU (arithmetic
and logic unit). The accumulator can be used to send or
receive data from the Internal Data bus.
Flag Register
There are five flip-flop in 8085 which are set or reset based on the outcome of
an arithmetic and logical operation.
1.Sign flag(S): S=1, if D7=1; otherwise S=0;
2.Zero flag(Z): Z=1,if A=00H; otherwise Z=0;
3.Auxiliary flag(AC): AC=1, if a carry is generated from the addition of fourth bit
from right of a 8-bit binary no. otherwise AC=0;
4.Parity flag(P): P=1, if A has even parity;
P=0, if A has odd parity;
5.Carry flag(CY): CY=1,Carry is generated;
CY=0,Carry is not generated;
Temporary Register:
As the name suggests this register acts as a
temporary memory during the arithmetic and
logical operations. Unlike other registers, this
temporary register can only be accessed by the
microprocessor and it is completely inaccessible to
programmers. Temporary register is an 8-bit
register.
Instruction Register:
This is a 8bit register. It is used to receive the 8 bit opcode of an
instruction from memory. It may be noted that opcode of an inst
ruction is only 8 bits, even though the instruction may be 3 bytes
long. It is not accessible to the programmer, that means there is
no instruction available which can manipulate the contents of
the I.R
W-Z Pair
These are 8bit registers. They are not accessible
to the programmer.
They are used for temporary storage inside the
8085, the 16 bit address operand of an
instruction. For example, when LDA C234H, ins
tructionis fetched, IR register will receive the op
code for LDA, and W and Zregisters will receive
C2H and 34H, respectively.
Stack Pointer(SP)
Stack pointer is also a 16-bit register which is used as a memory pointer.A
stack is nothing but the portion of RAM (Random access memory).Stack
pointer maintains the address of the last byte that is entered into stack.
Each time when the data is loaded into stack, Stack pointer gets
decremented. Conversely it is incremented when data is retrieved from stack.
Pin Functionality
TR
Reset
T1
T2
T3
OF
T4
T5
T6
TR
Reset
HALT
T1
TH
T2
T3
OF
T4
T5
T6
TR
Reset
HALT
T1
TH
T2
TW
READY
T3
OF
T4
T5
T6
Instruction Formats
Based on the length of the instructions, the instruction
set can be classified into three or more types.
a) One-byte instructions,
b) Two-byte instructions and
c) Three-byte instructions etc.
8 bit OPCODE
Single Byte
8 bit OPCODE
8 bit Data/8 bit device Address
One-Byte Instructions
Instructions that require only one byte in machine language
are called one-byte instructions.
These instructions just have the machine code or opcode
alone to represent the operation to be performed.
The common examples are the instructions that have their
operands within the processor itself.
Even though the instruction ADD M adds the content of a
memory location to that of the accumulator, its machine
code requires only one byte.
Two-Byte Instructions
Opcode
Operand
MVI
A, 7FH
ADI
IN
0FH
40H
Machine code /
Byte description
3E
First Byte
7F
Second Byte
C6
First Byte
OF
Second Byte
DB
First Byte
40
Second Byte
Hex code
3E 32
Three-Byte Instructions
Instructions that require three bytes in machine code are
called three-byte instructions.
In 8085 machine language, the first byte of the three-byte
instructions is the opcode which specifies the operation to
be performed.
The next two bytes refer to the 16-bit operand, which is
either a 16-bit number or the address of a memory
location.
Three-Byte Instructions
Examples
Opcode
Operand
Hex Code
JMP
2085H
C3
85
20
Byte
description
First byte
Second Byte
Third Byte
LDA
8850H
3A
50
88
First byte
Second Byte
Third Byte
LXI
H, 0520H
21
20
05
First byte
Second Byte
Third Byte
Immediate Addressing
Immediate addressing transfers the operand given in the
instruction.
A byte or a word into the destination register or Register
pair
Operand is part of the instruction itself.
Format of Immediate Addressing
Instructions
Opcode
Operand
LDA 850FH
This instruction is used to load the contents of the memory
location 850Fh into the accumulator.
STA 9001H
a) This instruction is used to store the contents of the
accumulator to the memory address 9001H.
b) In these instructions the memory address of the operand is
given in the instruction.
Register Addressing
Register addressing transfers a copy of a byte from the
source register to the destination register.
Operand is in register named in the instruction.
It features very fast execution, very limited register space
and requires good assembly programming.
Mostly the operand is within in the processor itself and so
the execution is faster.
Indirect Addressing
Indirect addressing transfers a byte or word between a
register and a memory location.
The memory location address is stored in a register and
that register is specified in the instruction.
Effective Address is calculated by the processor using
contents of the register specified in the instruction.
This type of addressing employs several accessestwo
accesses to retrieve the 16-bit address and a further access
(or accesses) to retrieve the data which is to be loaded in
the register.
UNIT II
b) Arithmetic operations,
c) Logical operations,
d) Branching operations
e) Machine-control operations
Operand
Addressing mode
Number of bytes
T states
MOV
Reg destination,
Reg source
Register direct
MOV
Reg destination,M
Memory Indirect
MOV
M,Reg source
Memory Indirect
MVI
Reg, byte
Immediate
MVI
M, byte
Immediate
10
LXI
rp, Dble
(rp=BC,DE,HL,SP)
Immediate
10
LDA
adr
Memory direct
13
STA
adr
Memory direct
13
LDAX
Rp (rp=BC,DE)
Memory Indirect
STAX
Rp (rp=BC,DE)
Memory Indirect
XCHG
HL & DE
Implicit
LHLD
adr
Memory direct
16
SHLD
adr
Memory direct
16
Mnemonic
Operand
Addressing mode
Number of bytes
T states
SPHL
Reg destination,
Reg source
Register direct
XTHL
Reg destination,M
Memory Indirect
PCHL
M,Reg source
Memory Indirect
IN
Reg, byte
Immediate
OUT
M, byte
Immediate
10
PUSH: - This instruction pushes the register pair onto stack. The contents
of the register pair designated in the operand are copied onto the stack in
the following sequence. The stack pointer register is decremented and the
contents of the highorder register (B, D, H, A) are copied into that location.
The stack pointer register is decremented again and the contents of the
low-order register (C, E, L, flags) are copied to that location.
Eg: - PUSH B
PUSH A
Parameters:
Addressing mode:Register
Bytes:1
Machine cycle (3) OFMC*, MW,MW
Flags/;None
POP: - This instruction pop off stack to register pair. The contents of
the memory location pointed out by the stack pointer register are
copied to the low-order register (C, E, L, status flags) of the
operand. The stack pointer is incremented by 1 and the contents of
that memory location are copied to the high-order register (B, D, H,
A) of the operand. The stack pointer register is again incremented
by 1
Eg: - POP H
POP A
Unit III
Hardware Interfacing , Data
Transfer Schemes& Support
Chips
Serial No.
Characterstics
Memory Mapped
I/O
Device length
16
In this Device address is
16 bit, lines A0-A15 are
used for generating the
device address
8
In this only either A0-A7
are used or A8-A15 are
used for address
generation
Control Signals
Instructions Supported
Instructions like
LDA,STA,LDAX RP,STAX
RP, MOV M,R, MOV R,M
Data Transfer
IT is possible between
any Register and Device.
2 ^ 8 Devices supported
Execution Speed
7 T-states / 13 T-states
10 T-States
Hardware Requirements
Complex as it has to
decode 16 bit Address
Programmed Input
10 H
8085
B it 6 Start
11 H
Bit 7 Status
12 H
8 Bit Data
Peripheral Device
Assumptions:
1)8085 is connected to a P.D through ports 10,11,
and 12 .
2)Port 10h is used to send start bit to PD
3)Port 11h is used for sending the status bit.
4)Port 12h is used to input one byte of data.
Working:
When the CPU wants to transfer data byte,it sends
a high start signal to the PD through port 10h.After
this the processor waits for the PD to get ready and
t he CPU continuously monitors the status line of
the PD through Port 11h.Once the device gets ready
it sends a high status signal through status line by
making it high(bit 7), CPU inputs one byte of data
through port 12h.
Programmed Output
10 H
8085
11 H
Bit 7 Status
8
b
it
d
a
t
a
12 H
B it 6 Start
Peripheral Device
Assumptions:
1)8085 is connected to a P.D through ports 10,11,
and 12 .
2)Port 10h is used to send start bit to PD
3)Port 11h is used for sending the status bit.
4)Port 12h is used to input one byte of data.
Working:
When the CPU wants to transfer data byte,it will
latch 8 bit data into port 12 h. A high start signal to
the PD through port 10h indicating that valid 8 bit
data is waiting at port 12h.After the PD has loaded
the data it sends a high status signal indicating that
the data byte is successfully loaded.
8085 is receiving data @ 100 bytes per second from a PD. For the
programmed input discussed earlier, calculate the wasted by CPU in waiting
for the PD to get ready(assume 3 MHZ internal clock)
T=1/100 HZ 0.01 sec
It takes 0.01 sec for PD to get ready
Useful time does not include time for start bit and waiting in loop.
Useful T-states are:IN 12H
MOV M,A
INX H
DCR C
JNZ LOOP
CPU
Peripheral Device
Service Subroutine:F100
F101
F102
F104
F107
F108
F10A
F10C
F10D
F10E
F10F
PUSH PSW
; Save Acc and Flags
PUSH H
;Save HL Contents
IN 12h ;Input data from device
LXI H,3000
;Set Pointer
MOV M,A
;Store data
MVI A,80
;Set Acknowledge bit
OUT 11
;Acknowledge Data Arrival
POP H ;Restore HL
POP PSW
;Restore Acc and Flag
EI
;Enable Interrupts
RET
; Return
TRANSPARENT Mode
This requires the most time to transfer a block of data,
yet it is also the most efficient in terms of overall
system performance.
The DMA controller only transfers data when the CPU
is performing operations that do not use the system
buses.
Characteristics of 8155/8156
256 Bytes of memory organized as 8-bit words
Single +5 V supply
2-Programmable 8 bit I/O ports
1-Programmable 6-bit I/O port
Programmable 14 bit down Timer
8155 is active low whereas 8156 is active high
A15-A8
0010 0001
Ad7-Ad0
0010 0001
A13
Ad2
8156
Ad1
Ad0
AD15-AD8=AD7-AD0
21h
D6
D5
D4
D3
D2
D1
D0
Port A
Port B
D0
Effect
D1
effect
Input
Input
output
Output
Port C
D3
D2
Effect
8156
Port A H/S+3bits
8156
Full H/S
pc0
INTR A
pc1
BF A
pc2
STB
STBAA
pc3
Output
pc4
Output
pc5
Output
pc0
INTR A
pc1
BF A
pc2
STB A
pc3
pc4
INTR A
BF B
pc5
STB B
0011 1010
MVI A,3A
OUT 20h
---- > 3A
Unit IV
8086 Microprocessor
Introduction
Architecture of 8086
CF (Carry Flag) - holds the carry after 8 bit or 16 bit addition - holds borrow
after 8 bit or 16 bit subtraction performed
PF (Parity Flag) - If the lower 8 bit of the result is having odd parity (i.e. odd
number of 1s) - PF is set to 0 - PF is set to 1 if the lower 8 bit of result is
having even parity.
AF (Auxiliary Carry Flag) - holds the carry after addition - the borrow after
subtraction of the bits in bit position 3 - (LSB is treated as bit position 0) used by DAA instructions to adjust the value in AL after a BCD addition or
subtraction.
ZF (Zero Flag) - indicates that the result of an arithmetic or logic operation
is zero - If Z=1, the result is zero - if Z=0, the result is not zero.
SF (Sign flag) - holds the arithmetic sign of the result after an arithmetic or
logic instruction is executed - If S-0, the sign bit is 0 and the result is
negative.
RD- Whenever the read signal ( ) is a logic 0, the 8086 reads data from
memory or I/O device through the data bus.
TEST The test pin is an input that is tested by the WAIT instruction. If pin
is at logic 0, then WAIT instruction functions as a NOP (No operation)
instruction. If pin is at logic 1, then WAIT instruction waits for pin to
become a logic 0. This pin is often connected to the BUSY input of 8087
numeric coprocessor to perform floating point operations.
READY: This input is used to insert wait states into the timing of the 8086.
If the READY pin is at logic 1 then it has no effect on the operation of the
microprocessor. If the ready pin is at logic 0, the 8086 enters into wait
state and remains idle. This pin is used to interface slowly operating
peripherals with 8086.