Professional Documents
Culture Documents
8085 Part I-III
8085 Part I-III
General overview of
microprocessor
2. Memory interfacing
What Microprocessor
is ?
Types of Buses
Address Bus
Data Bus
Control Bus
Generally contains one wire
i.e. 10 bytes of
memory
can store 10
bytes of data
10 x 8 bit memory
Or
10 byte memory
Accessing Memory or Memory Interfacing
11 Register 3
10 Register 2
01 Register 1
00 Register 0
0
0 A
0 1
1
2 to 4 Decoder
1
0 A
11 0
Calculate the address lines required for 10 K Byte
memory chip
1 K Byte = 1024 Byte of memory
Then 10 K Byte = 10 x 1024 Byte of memory
Then 2n = 10240
Or n = 13.32 ≈ 14
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000H
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0FFFH
Draw the memory map to access 256
Byte memory using 16 bit address
A15 line
A14
A13
A12 C
A7
A11 S
A6
A10
A5
A9 256 Byte
A4
A8 Memory
A3
For addressing 256 Byte memory A2
we required only 8 address line (A0 to
A1
A7). Remaining 8 address lines (A8 to
A0
A15) is used of chip selection
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 Address
0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 7F00H
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7FFFH
Memory
Classification Memory
Primary Secondary
Memory Memory
Hard Disk,
RAM ROM
Floppy,
CD
Dynamic
Static RAM RAM Erasable Permanent
Flash Masked
EPROM EEPROM Memory ROM PROM
Random Access Memory (RAM)
Static RAM (SRAM)
Flash Memory
• It can be erased and reprogrammed a million
times
1. Pin diagram of 8085
2. I/O interfacing
INTEL 8085 Pin Configuration
The Address and Data Bus Systems
4FH
2005H
microprocessor
0000H
Memory
Step 1
• Lower order address bus [AD7 to AD0] are connected with a latch
when it is activated
• But when it is deactivated output does not
To write data
4FH in the
memory
location 2005H
Timing Diagram for Memory Read
To read data
from the
memory
location 2005H
I/O DEVICE
Devices other than memory are known
as I/O devices or Input-Output Devices
Interfacing of I/O device with
8085
In peripheral I/O, device is identified by
an 8-bit address
IN C0H
Memory Code
4125H DBH
4126H C0H
Timing Diagram of ‘OUT’ instruction
OUT 12H
Memory Code
4150H D3H
4151H 12H
Device selection logic
Writing to an Output Port
(7EH)
A7
A6 OUT 7EH
A5
A4
A3
A2
A1
C
A0
S
IO / M
Data I/O Device Data
WR Bus Bus
A7 A6 A5 A4 A3 A2 A1 A0 Address
0 1 1 1 1 1 1 0 7EH
Device selection logic
Reading an Input Port
(5DH)
A7
A6 IN 5DH
A5
A4
A3
A2
A1
C
A0
S
IO / M Data Data
Bus I/O Device Bus
RD
A7 A6 A5 A4 A3 A2 A1 A0 Address
0 1 0 1 1 1 0 1 5DH
Absolute vs. Partial Decoding
In partial decoding some of the address
A7 lines are used. As a result the device has
A6 multiple address.
A5
A4
A3
A2
CS
IO / M
Data Data
Bus I/O Device Bus
RD
A7 A6 A5 A4 A3 A2 A1 A0 Address
0 1 1 1 1 1 X X 7CH – 7FH
Use of Decoder A7 A6 A5 A4 A3 A2 A1 A0 Address
Device 1 1 1 1 1 1 1 0 0 FC H
Device 2 1 1 1 1 1 1 0 1 FD H
Device 3 1 1 1 1 1 1 1 0 FE H
Device 4 1 1 1 1 1 1 1 1 FF H
A7
A6
A5
A4
A3
CS
11 A2
1
0 A
2 to 4 Decoder
1
0
1 A
0 0
0
In memory-mapped addressing mode
Data transfer between any general- Data is transfer only between accumulator
purpose register and I/O port. and I.O port
SP
SP is Stack PC
Pointer
PC is Program Counter used by µP itself.
It stores the 16-bit address of the next
memory register to be executed
Flag Register
D0
S Z AC P
CY
S =1 Z =1
RESULT
P =1
EVEN NO. OF
NEGATIV 1’S
E IS ZERO
=0 =0
=0
RESULT IS ODD NO. OF
POSITIVE 1’S
NOT ZERO
AC =1
CARRY
CY =1
GENERATED CARR
BY D3 GENERATE
D
=0
=0
CARRY
OTHERWISE
NOT
GENERA
Instruction Format
Each instruction has two parts
OPCODE: Operation to be performed
be
performed
OPCODEMOV A, BOPERAND
Instruction Byte Size
Number of registers required to store an instruction
in memory
HL 76 1 Byte
T
STA 32 15 30 3 Byte
3015H
Instruction Timing
Clock: A Clock is a square wave generator which is used
to synchronize various devices in the microprocessor and in
the system.
MVI A, 35 H
Memory Code
3010 H 3E H
3011 H 35 H
Steps:
Timing Diagram Opcode Fetch (4 T-state)
Place the address 3010H in the address bus
LXI H 2035H
Activate ALE signal
Memory Code
Activate Read signal
0000 H XX
Copy Opcode 21 H in the data bus
---- -- Memory Read (3 T-state)
---- -- Place the address 3011H in the
address bus
3010 H 21 H
Activate ALE signal
3011 H 35 H Activate Read signal
3012 H 20 H Copy Data 35 H in the data bus
Immediate Addressing
Data itself is specified in the instruction
Direct Addressing
Data stored in memory and that address is specified in the instruction
Implicit Addressing
No data is specified in the instruction
Types of
Instruction
1. Data Transfer Operation
2. Arithmetic Operation
3. Logical Operation
4. Branching & machine Control
Operation
• MOV Rd,
Rs
Rd: Destination
Rd Rs
Register Rs; Source
Register
Example:
MOV A,B
MOV C,H
MOV D,C
Addressing Mode:
Register Instruction Size: 1
• MVI Rd, <8-Bit
data> Rd
<8-Bit data>
Example:
MVI A, 54H
MVI C, 61H
MVI D,
8CH Addressing Mode: Immediate
Instruction Size: 2 Bytes
• LXI Rp, <16-Bit
data> Rp
Rp: Register <16-Bit data>
Pair
Example:
LXI H,5004H
LXI B,6021H
LXI D,840CH
Addressing Mode: Immediate
Instruction Size: 3 Bytes
• MVI M, <8 bit data>
• MOV R, M
R XXXXH
• MOV M, R
XX XX
H L
R: Register
M; Memory Register µP MEMORY
2003H
42 D 42H
42H 2004H
72H 2005H
Example: 20 04
H L
MEMORY
LXI H,2004H µP
MOV D,
M
• LDA <16 Bit Address>
ACC
1600H 2500H
Mem
ACC
µP ory µP Memory
Memory Code
41FFH 32H
4200H 6AH
4201H 52H
• LDAX • STAX
B B
• LDAX
D • STAX
D
ACC ACC
Memory Memory
B C B C
µP µP
1660H 2080H
1661H 2081H
H L H L
Memory Memory
µP µP
LHLD 1660H
Addressing Mode:
Direct Instruction Size: 3
• XCHG
Exchange the contents of H-L with D-E register
pair
ab cd pq rs
D E D E
pq rs ab cd
H L H L
µP µP
Addressing Mode:
Register Instruction Size: 1
ADDITION
• ADD
Acc R Acc
R
• ADD
M Acc MEMORY Acc
(Address from H-
L)
• ADI <8-BIT
Data>
Acc 8-Bit Data Acc
ADDITION with
• ADC CARRY
R
Acc R CY Acc
• ADC
M
Acc MEMORY CY Acc
(Address from H-
L)
• ACI <8-BIT
Data>
Acc 8-Bit Data CY Acc
SUBTRACTION
• SUB
Acc R Acc
R
• SUB
M Acc MEMORY Acc
(Address from H-
L)
• SUI <8-BIT
Data>
Acc 8-Bit Data Acc
SUBTRACTION with
• SBB
BORROW
R
Acc R CY Acc
• SBB
M
Acc MEMORY CY Acc
(Address from H-
L)
• SBI <8-BIT
Data>
Acc 8-Bit Data CY Acc
• DAD 16 Bit Addition
Rp
H L Rp H L
LXI H,1800H 18 00
XX XX
H L
B C
LXI B,1200H 18 00 12 00
H L B C
DAD B 2A
00 12 00
L B C
H
HLT
Increment &
Decrement
• INR
R R
R
• DCR
R R R
• INX
Rp Rp Rp
• DCX
Rp Rp Rp
• DAA
Decimal Adjust Accumulator
The DAA instruction is provided to correct the problem associated with
BCD (Binary Coded Decimal) addition
Digit BCD
Unpacked BCD 0 0000
In unpacked BCD, the lower 4 bits of the number represent 1 0001
the BCD number, and the rest of the bits are 0 2 0010
17 17
+ 28 45 + 28
(0100 0101) 3F (0011
1111)
To correct this problem, the programmer must add 6 (0110) to the low
digit: 3FH + 06H = 45H.
• ANA M
Acc /M/DATA Acc
• ANI <8-BIT
Data>
OR
• ORA R
Operation
• ORA M
Acc R/M/DATA Acc
• ORI <8-BIT
Data> XOR
• XRA R
Operation
• XRA M
Acc R/M/DATA Acc
• XRI <8-BIT
Rotate Operation
• RLC (Rotate Accumulator
Left) X CY 1 CY
1 0 1 0 1 1 0 0 RLC 0 1 0 1 1 0 0 1
1 0 1 0 1 1 0 0 RRC 0 1 0 1 0 1 1 0
• CMC
Complement of the content of the Carry bit
Jump Instruction
2000H Instruction
1
2002H
2001H .Instruction
2
2003H .
2004H JMP 200AH
2005H
2006H
2007H .
2008H .
2009H .
200AH .
200BH .
200CH .
200DH .
200EH .
Conditional Jump
• JP <16-Bit Address> jump when s = 0
• JM <16-Bit Address> jump when s = 1
• NOP
No operation. Content of the program counter
is incremented by 1
• HLT
Microprocessor stops program execution until
an interrupt