Unit-1 8085 Micoprocessor
Unit-1 8085 Micoprocessor
Microprocessors and
Microcontrollers
1
UNIT-I:8085 Microprocessor: Evolution of
microprocessors, The 8085 Microprocessor,
Microprocessor communication and bus
timings, Generating control signals, 8085
MPU and its architecture and pin diagram,
Decoding and Executing an Instruction,
Instruction set and Assembly Language
programming.
2
Brief Discussion
• What is Computer?
3
What is Microprocessor?
– 1960s’ CPU – designed with logic gates
– LSI – Large Scale Integration
– SSI to LSI – called Microprocessor
– Microcomputer
– Intel – 4 bit microprocessor 4004 in 1971
– 8 bit microprocessor 8080
– 8-bit 8085 (8 bit data bus + 16 bit address bus)
– 16-bit 8086 (16 bit data bus + 20 bit address
bus)
– 16 bit processors – 8088,80186,80188, 80286
– 32 bit processors – 80386 , 80486, 80586 (P)
4
Microprocessor
Microprocessor is a brain of computer.
It is a single chip which is capable of processing data.
It controls all components like memory, I/O,External
devices.
It executes sequence of instructions.
Microprocessor fetch, decode and execute the
instructions.
Internal Architecture of Microprocessor is complex.
5
Historical Background
• First generation (1939-1954)-Vaccum tubes
• Second generation (1954-1959)- Invention of
Transistor->Bell Laborites
• Third generation (1959-1971)- Invention of Integrated
Circuit
• Fourth generation (1971-present)- Development of First
Microprocessor
• Developed by Intel
-> 4004 “cpu-on-a-chip”.
• 1976- Introduction of Microcontroller
Developed by Intel
->8048 “computer-on-a-chip”.
6
Applications
• General Purpose µp
-> Desktop, PCs, Laptops, Workstations,
Servers.
Introduction
4-Bit Microprocessors
8-Bit Microprocessors
16-Bit Microprocessors
32-Bit Microprocessors
64-Bit Microprocessors
2
INTRODUCTION
Fairchild Semiconductors (founded in 1957)
invented the first IC in 1959.
In 1968, Robert Noyce, Gordan Moore, Andrew
Grove resigned from Fairchild Semiconductors.
They founded their own company Intel (Integrated
Electronics).
Intel grown from 3 man start-up in 1968 to industrial
giant by 1981.
It had 20,000 employees and $188 million revenue. 3
4-BIT MICROPROCESSORS
4
INTEL
4004
Introduced in 1971.
It was the first
microprocessor by Intel.
It was a 4-bit µP.
Its clock speed was
740KHz.
It had 2,300
transistors.
It could execute around
60,000 instructions per 5
second.
INTEL
4040
Introduced in 1974.
It was also 4-bit µP.
6
8-BIT MICROPROCESSORS
7
INTEL
8008
Introduced in 1972.
It was first 8-bit µP.
Its clock speed was 500
KHz.
Could execute 50,000
instructions per second.
8
INTEL
8080
Introduced in 1974.
It was also 8-bit µP.
Its clock speed was 2
MHz.
It had 6,000
transistors.
Was 10 times faster
than
8008.
9
Could execute 5,00,000
instructions per
Introduced in 1976.
INTEL 8085 It was also 8-bit µP.
Its clock speed was 3 MHz.
Its data bus is 8-bit and
address bus is 16-bit.
It had 6,500
transistors.
Could execute 7,69,230
instructions per
second.
It could access 64 KB
of
memory.
Over 100 million copies 10
Itwere
had sold.
246 instructions.
16-BIT MICROPROCESSORS
11
Introduced in 1978.
16
Introduced in 1986.
INTEL It was first 32-bit µP.
80386 Its data bus is 32-bit and
address bus is 32-bit.
It could address 4 GB of
memory.
It had 2,75,000
transistors.
Its clock speed varied from 16
MHz to 33 MHz depending upon
the various versions.
Different versions:
80386 DX
80386 SX
80386 SL
Intel 80386 became the best 17
selling microprocessor in history.
INTEL Introduced in 1989.
80486 It was also 32-bit µP.
It had 1.2 million transistors.
Its clock speed varied from
16 MHz to 100 MHz
depending upon the various
versions.
It had five different versions:
80486 DX
80486 SX
80486 DX2
80486 SL
80486 DX4
8 KB of cache memory was
introduced. 18
Introduced in 1993.
INTEL PENTIUM It was also 32-bit µP.
It was originally named 80586.
Its clock speed was 66 MHz.
Its data bus is 32-bit and
address bus is 32-bit.
It could address 4 GB of
memory.
Could execute 110
million
instructions per second.
Cache memory:
8 KB for instructions.
19
8 KB for data.
INTEL PENTIUM
PRO
Introduced in 1995.
It was also 32-bit µP.
It had L2 cache of 256 KB.
It had 21 million transistors.
It was primarily used in
server systems.
Cache memory:
8 KB for instructions.
8 KB for data.
20
It had L2 cache of 256
KB.
INTEL PENTIUM
II
Introduced in 1997.
It was also 32-bit µP.
Its clock speed was 233
MHz to 500 MHz.
Could execute 333 million
instructions per second.
MMX technology was
supported.
L2 cache & processor
were on one circuit. 21
INTEL PENTIUM II
XEON
Introduced in 1998.
It was also 32-bit µP.
It was designed for servers.
Its clock speed was 400
MHz to 450 MHz.
L1 cache of 32 KB & L2
cache of 512 KB, 1MB or
2 MB.
It could work with 4 Xeons
in same system. 22
INTEL PENTIUM
III
Introduced in 1999.
It was also 32-bit µP.
Its clock speed varied
from 500 MHz to 1.4
GHz.
It had 9.5 million
transistors.
23
INTEL PENTIUM
IV
Introduced in 2000.
It was also 32-bit µP.
Its clock speed was from
1.3 GHz to 3.8 GHz.
L1 cache was of 32 KB &
L2 cache of 256 KB.
It had 42 million
transistors.
All internal connections
were made from aluminium 24
to copper.
INTEL DUAL Introduced in 2006.
CORE It is 32-bit or 64-bit µP.
It has two cores.
Both the cores have there
own internal bus and L1
cache, but share the
external bus and L2 cache
(Next Slide).
It supported SMT
technology.
SMT: Simultaneously Multi-
Threading
E.g.: Adobe Photoshop
25
supported SMT.
33
64-BIT MICROPROCESSORS
34
INTEL CORE
2
Introduced in 2006.
It is a 64-bit µP.
Its clock speed is from
1.2 GHz to 3 GHz.
It has 291 million
transistors.
It has 64 KB of L1 cache
per core and 4 MB of L2
cache.
It is launched in three different
versions:
Intel Core 2 Duo
28
Intel Core 2 Quad
Intel Core 2 Extreme
INTEL CORE
I7
Introduced in 2008.
It is a 64-bit µP.
It has 4 physical cores.
Its clock speed is from
2.66 GHz to 3.33 GHz.
It has 781 million
• transistors.
It has 64 KB of L1
cache per core, 256
KB of L2 cache and298
MB of L3 cache.
INTEL CORE
I5
Introduced in 2009.
It is a 64-bit µP.
It has 4 physical cores.
Its clock speed is from
2.40 GHz to 3.60 GHz.
It has 781 million
• transistors.
It has 64 KB of L1
cache per core, 256
KB of L2 cache and308
MB of L3 cache.
INTEL CORE
I3
Introduced in 2010.
It is a 64-bit µP.
It has 2 physical cores.
Its clock speed is from
2.93 GHz to 3.33 GHz.
It has 781 million
• transistors.
It has 64 KB of L1
cache per core, 512
KB of L2 cache and314
MB of L3 cache.
Basic Concepts of Microprocessors
Differences between:
40
The Salient Features of 8085 Microprocessor:
44
Intel 8085 Microprocessor
• Microprocessor consists of five essential blocks.
(1) Arithmetic Logic Section
(2) Register Section
(3) The Interrupt Control Section
(4) Serial I/O Section
(5) The Timing And Control Unit
(1) Arithmetic & Logic Section: This section consists of:
(a) Accumulator (A)
(b) Temporary Register (TR)
(c) Flag Register (FR)
(d) Arithmetic Logic Unit (ALU)
45
Special purpose Register (Accumulator)
Arithmetic and/or logic operations on one or two operations are the basic
data transformations implemented in a μρ one of thesetwo operands is
always in the accumulator.
Accumulator is an 8-bit register accessible to the user is connected to the
8-bit internal data bus.
𝜇𝑝. The on-chip clock oscillator which produces the internal clock is a
• The timing and control section supervise the complete operation of the
part of this section. The timing and control section also has a state
generator circuit to generate 10 different states namely T1, T2, T3, T4,
T5, T6, TRESET, THALT, TWAIT and THOLD.
• The instruction fetch portion of an instruction cycle requires a machine
cycle for each byte of the instruction to be fetched. Since an instruction
consists of 1 to 3 bytes (1, 2 or 3), the instruction fetch is one to three
52
machine cycles in duration.
Pin Diagram of 8085
Interrupts
53
X1 & X2
Pin 1 and Pin 2 (Input)
These are also called
Crystal Input Pins.
To generate clock
signals internally,
8085 requires external
inputs from X1 and X2.
5
4
RESET IN and RESET OUT
Pin 36 (Input) and Pin 3 (Output)
RESET IN:
◦ It is active low
signal.
◦ It is an output signal.
58
SID and SOD
Pin 4 (Input) and Pin 5 (Output)
SOD (Serial Output
Data):
RST 7.5
RST 6.5
RST 5.5
INTR
62
Classification of Interrupts
Maskable and Non-Maskable
63
Maskable Interrupts
Maskable interrupts are those
interrupts which can be enabled or
disabled.
64
Vectored Interrupts
Theaddresses to which program
control goes:
Name Vectored Address
Interrupt Priority
TRAP 1
RST 7.5 2
RST 6.5 3
RST 5.5 4
INTR 5
66
Mask Non- Vecto Non- Edge Level Both Priority
able Mask red Vecto Trigg Trigg Edge
Int able Int red ered ered and
Int Int Level
Triggere
d
INTR-5
INTA
Pin 11 (Output)
It stands for interrupt
acknowledge.
It is an out going
signal.
It is an active
signal.
low
Low output on this pin
indicates that
microprocessor has
acknowledged the
INTR request.
68
Address and Data Pins
Address Bus:
69
Address and Data Pins
Data Bus:
70
AD0 – AD7
Pin 19-12 (Bidirectional)
These pins serve the dual
purpose of transmitting lower
order address and data
byte.
72
ALE
Pin 30 (Output)
It is used to enable Address
Latch.
If ALE = 1 then
◦ Bus functions as address
bus.
If ALE = 0 then
◦ Bus functions as data bus.
73
S0 and S1
Pin 29 (Output) and Pin 33 (Output)
S0 and S1 are called Status
Pins.
0 0 Halt
0 1 Write
1 0 Read
1 1 Opcode Fetch
74
IO/M
Pin 34 (Output)
This pin tells whether I/O
or memory operation is
being performed.
If IO/M = 1 then
◦ I/O operation is
being
performed.
If IO/M = 0 then
◦ Memory operation is
being performed.
75
IO/M
Pin 34 (Output)
The operation being performed is indicated
by S0 and S1.
If S0 = 0 and S1 = 1 then
◦ It indicates WRITE operation.
If IO/M = 0 then
◦ It indicates Memory operation.
Operations IO/M S0 S1
Opcode Fetch 0 1 1
Memory Read 0 1 0
Memory Write 0 0 1
I/O Read 1 1 0
I/O Write 1 0 1
Interrupt Ack. 1 1 1
77
RD
Pin 32 (Output)
RD stands for Read.
It is an active low signal.
It is a control signal used
for Read operation either
from memory or from Input
device.
A low signal indicates that
data on the data bus
must be placed either
from selected memory
location or from input
device.
78
WR
Pin 31 (Output)
WR stands for Write.
It is also active low signal.
It is a control signal used
for Write operation either
into memory or into output
device.
A low signal indicates that
data on the data bus
must be written into
selected memory location
or into output device.
79
READY
Pin 35 (Input)
This pin is used to
synchronize slower
peripheral devices with
fast microprocessor.
A low value causes the
microprocessor to enter
into wait state.
The microprocessor
remains in wait state
until the input at this pin
goes high.
80
HOLD
Pin 38 (Input)
HOLD pin is used to request
the microprocessor for
DMA transfer.
A high signal on this pin is a
request to microprocessor to
relinquish the hold on
buses.
This request is sent by DMA
controller.
Intel 8257 and Intel 8237 are
two DMA controllers.
81
HLDA
Pin 39 (Output)
HLDA stands for Hold
Acknowledge.
The microprocessor uses this
pin to acknowledge the receipt
of HOLD signal.
When HLDA signal goes high,
address bus, data bus, RD,
WR, IO/M pins are tri-stated.
This means they are cut-off
from external environment.
82
HLDA
Pin 39 (Output)
The control of these
buses goes to
DMA Controller.
Control remains at
DMA Controller until
HOLD is held high.
When HOLD goes
low, HLDA also goes
low and the
microprocessor takes
control of the buses.
83
VSS and VCC
Pin 20 (Input) and Pin 40 (Input)
+5V power supply is
connected to VCC.
Ground signal is
connected to VSS.
84
Microprocessor Communication
and bus timings
85
Timing Diagram
86
Ex:Iiiustrate the steps and the timing of data flow when the
instruction code 0100 1111 (4FH-MOV C,A) stored in location
2005H is being fetched.
87
Generating control signals
88
Case(i): IO/=1, =0,=1
Case(ii): IO/=1, =1,=0
Case(iii):IO/=0, =0,=1
Case(iv):IO/=0, =1,=0
89
Decoding and Executing an
Instruction
90
Assme that the accumulator contains data byte 82H, and
the instruction MOV C,A (4FH) is fetched list the steps in
decoding and executing the instruction.
91
92
Memory READ Machine Cycle:
93
94
Memory WRITE Machine Cycle:
95
Addressing modes
Every instruction of a program has to operate on a data. The
method of specifying the data to be operated by the instruction is
called Addressing. The 8085 has the following 5 different types
of addressing.
1. Immediate Addressing
2. Direct Addressing
3. Register Addressing
4. Register Indirect Addressing
5. Implied Addressing
96
1. Immediate Addressing: In immediate addressing mode, the
data is specified in the instruction itself. The data will be a
part of the program instruction.
EX. MVI B, 3EH - Move the data 3EH given in the instruction
to B register; LXI SP, 2700H.
2. Direct Addressing: In direct addressing mode, the address of
the data is specified in the instruction. The data will be in
memory. In this addressing mode, the program instructions and
data can be stored in different memory.
EX. LDA 1050H - Load the data available in memory location
1050H in to accumulator; SHLD 3000H 19
3. Register Addressing: In register addressing mode, the
instruction specifies tthe name of the register in which the data
is available.
EX. MOV A, B - Move the content of B register to A register;
SPHL; ADD C 97
4. Register Indirect Addressing: In register indirect addressing
mode, the instruction specifies the name of the register in
which the address of the data is available. Here the data will
be in memory and the address will be in the register pair.
98
Instruction set
The programmer can write a program in assembly
language using these instructions. These instructions
have been classified into the following groups:
1. Data Transfer Group
2. Arithmetic Group
3. Logical Group
4. Branch Control Group
5. I/O and Machine Control Grou
99
1.Data Transfer Group
1. MOV r1, r2 (Move Data; Move the content of the one register to
another). [r1] <-- [r2]
2. MOV r, m (Move the content of memory register). r <-- [M]
3. MOV M, r. (Move the content of register to memory). M <-- [r]
4. MVI r, data. (Move immediate data to register). [r] <-- data.
5. MVI M, data. (Move immediate data to memory). M <-- data.
6. LXI rp, data 16. (Load register pair immediate). [rp] <-- data 16
bits, [rh] <-- 8 LSBs of data.
7. LDA addr. (Load Accumulator direct). [A] <-- [addr].
8. STA addr. (Store accumulator direct). [addr] <-- [A].
9. LHLD addr. (Load H-L pair direct). [L] <-- [addr], [H] <--
[addr+1].
100
1.Data Transfer Group
10. SHLD addr. (Store H-L pair direct) [addr] <-- [L], [addr+1] <--
[H].
11. LDAX rp. (LOAD accumulator indirect) [A] <-- [[rp]] 13
12. STAX rp. (Store accumulator indirect) [[rp]] <-- [A].
13. XCHG. (Exchange the contents of H-L with D-E pair) [H-L] <-->
[D-E]
14. IN 8bit port address-Read data from the input port.
15. OUT 8bit port address-Write data from the output port.
101
2. Arithmetic Group
1. ADD r. (Add register to accumulator) [A] <-- [A] + [r].
2. ADD M. (Add memory to accumulator) [A] <-- [A] + [[H-L]].
3. ADC r. (Add register with carry to accumulator). [A] <-- [A] + [r] + [CS].
4. ADC M. (Add memory with carry to accumulator) [A] <-- [A] + [[H-L]]
[CS].
5. ADI data (Add immediate data to accumulator) [A] <-- [A] + data.
6. ACI data (Add with carry immediate data to accumulator). [A] <-- [A] + data
+ [CS].
7. DAD rp. (Add register paid to H-L pair). [H-L] <-- [H-L] + [rp].
8. SUB r. (Subtract register from accumulator). [A] <-- [A] – [r].
9. SUB M. (Subtract memory from accumulator). [A] <-- [A] – [[H-L]].
10. SBB r. (Subtract register from accumulator with borrow). [A] <-- [A] – [r] –
[CS].
11. SBB M. (Subtract memory from accumulator with borrow). [A] <-- [A] –
[[H-L]] – [CS].
12. SUI data. (Subtract immediate data from accumulator) [A] <-- [A] – data.
13. SBI data. (Subtract immediate data from accumulator with borrow). [A] <- -
102
[A] – data – [CS].
14. INR r (Increment register content) [r] <-- [r] +1.
15. INR M. (Increment memory content) [[H-L]] <-- [[H-L]] +
1.
16. DCR r. (Decrement register content). [r] <-- [r] – 1.
17. DCR M. (Decrement memory content) [[H-L]] <-- [[H-L]] –
1.
18. INX rp. (Increment register pair) [rp] <-- [rp] – 1. 19. DCX
rp (Decrement register pair) [rp] <-- [rp] -1.
20. DAA (Decimal adjust accumulator)
103
3. Logical Group
1. ANA r. (AND register with accumulator) [A] <-- [A] ^ [r].
2. ANA M. (AND memory with accumulator). [A] <-- [A] ^ [[H-L]].
3. ANI data. (AND immediate data with accumulator) [A] <-- [A] ^ data.
4. ORA r. (OR register with accumulator) [A] <-- [A] v [r].
5. ORA M. (OR memory with accumulator) [A] <-- [A] v [[H-L]]
6. ORI data. (OR immediate data with accumulator) [A] <-- [A] v data.
7. XRA r. (EXCLUSIVE – OR register with accumulator) [A] <-- [A] v [r]
8. XRA M. (EXCLUSIVE-OR memory with accumulator) [A] <-- [A] v [[H-L]]
9. XRI data. (EXCLUSIVE-OR immediate data with accumulator) [A] <-- [A]
10. CMA. (Complement the accumulator) [A] <-- [A]
11. CMC. (Complement the carry status) [CS] <-- [CS]
12. STC. (Set carry status) [CS] <-- 1.
13. CMP r. (Compare register with accumulator) [A] – [r]
14. CMP M. (Compare memory with accumulator) [A] – [[H-L]]
15. CPI data. (Compare immediate data with accumulator) [A] – data
104
16. RLC (Rotate accumulator left) [An+1] <-- [An], [A0] <-- [A7],
[CS] <-- [A7]
17. RRC. (Rotate accumulator right) [A7] <-- [A0], [CS] <-- [A0], [An] <-- [An+1].
18. RAL. (Rotate accumulator left through carry) [An+1] <-- [An], [CS] <-- [A7], [A0]
<-- [CS].
19. RAR. (Rotate accumulator right through carry) [An] <-- [An+1], [CS] <-- [A0],
[A7] <-- [CS]
105
4. Branch Group
1. JMP addr (label). (Unconditional jump: jump to the instruction specified by
the address). [PC] <-- Label.
2. Conditional Jump addr (label): After the execution of the conditional jump
instruction the program jumps to the instruction specified by the address (label)
if the specified condition is fulfilled.
1. JZ addr (label). (Jump if the result is zero)
2. 2. JNZ addr (label) (Jump if the result is not zero)
3. 3. JC addr (label). (Jump if there is a carry)
4. 4. JNC addr (label). (Jump if there is no carry)
5. 5. JP addr (label). (Jump if the result is plus)
6. 6. JM addr (label). (Jump if the result is minus)
7. 7. JPE addr (label) (Jump if even parity)
8. 8. JPO addr (label) (Jump if odd parity)
3. CALL addr (label) (Unconditional CALL: call the subroutine identified by
the operand)
4. RET (Return from subroutine)
106
5. Stack, I/O and Machine Control Group
1. IN port-address. (Input to accumulator from I/O port) [A] <-- [Port]
2. OUT port-address (Output from accumulator to I/O port) [Port] <-- [A]
3. PUSH rp (Push the content of register pair to stack)
4. PUSH PSW (PUSH Processor Status Word)
5. POP rp (Pop the content of register pair, which was saved, from the stack)
6. POP PSW (Pop Processor Status Word)
7. HLT (Halt)
8. XTHL (Exchange stack-top with H-L)
9. SPHL (Move the contents of H-L pair to stack pointer)
10. EI (Enable Interrupts)
11. DI (Disable Interrupts)
12. SIM (Set Interrupt Masks)
13. RIM (Read Interrupt Masks)
14. . NOP (No Operation)
107
Assembly Language
programming
1) Addition program:
Solution1:
MVI A,34H
MVI B,45H
ADD B
HLT
Solution 2:
LDA 2000
MOV B,A
LDA 2001
ADD B
STA 2003
HLT
108