Microprocessor Unit 2
Microprocessor Unit 2
(102045610)
MODULE 2
MEMORY AND I/O INTERFACING
Module 2
• Various types of memories
• Review of logic devices for interfacing, RAM and ROM
• Interfacing with 8085 based systems
• Interfacing input and output devices
• Memory mapped I/O
k inputs (address)
2k x n n outputs (data)
ROM
5
11011100
12
RAM v/s ROM
RAM ROM
The data is not permanent but it
The data is permanent. It can be altered but only a
Data can be altered any number of
limited number of times that too at slow speed.
times.
Speed It is a high-speed memory. It is much slower than the RAM.
CPU The CPU can access the data The CPU can not access the data stored on it. In
Interaction stored on it. order to do so, the data is first copied to the RAM.
Size and
Large size with higher capacity. Small size with less capacity.
Capacity
Firmware like BIOS or UEFI. RFID tags,
Primary memory (DRAM DIMM microcontrollers, medical devices, and at places
Usage
modules), CPU Cache (SRAM). where a small and permanent memory solution is
required.
Cost It doesn’t come cheap. Way cheaper than RAM.
13
PROF. SUNAYANA DOMADIA DIGITAL FUNDAMENTALS (3130704) 14
Magnetic Disk Floppy Disk
15
PROF. SUNAYANA DOMADIA DIGITAL FUNDAMENTALS (3130704) 16
Hard Disk Optical Disk
data lines=8
then
Address NXM 1. number of registers / memory
Input Memory locations = N=213 = 8192
2. word length M= 8 bit
A0 Therefore, N X M= 8192 X 8
Output Buffer
RD
Data Output
23 23
Memory structure
25
Memory Interfacing
26 26
Memory Interfacing: Example 1
Interface 4kB of EPROM with starting address from 0000H and 2kB of RAM with starting
address followed by EPROM
Step-1:
Total EPROM required = 4kB
Chip size available = 4kB
No. of chips required = 4kB/4kB=1
27 27
Memory Interfacing: Example 1
Step-2:
EPROM Chip-1:
Step-3:
RAM Chip-1:
= 0FFFH+1
= 1000H
= 17FFH
28
Memory Interfacing: Example 1
Step-4: Memory A A A A A A A A A A A A A A A A
Map 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Start
Address 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 0000 H
M End
4k
Address
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
0FFF H
Start
Address 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
RAM 1000 H
2k End
Address 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1
17FF H
EPROM
• Required Address Lines: A11 to A15.
• Now, EPROM has two Possibilities, either 00000 b or
00001 b.
• Therefore, it requires Y0 and Y1 outputs of decoder.
30 30
Memory Interfacing: Example 1
A A A A A A A A A A A A A A A A
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Start
Addres 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
s
EPRO 0000 H
M End
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
Addres
s
Start
0FFF H
Addres 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
s
1000 H
RAM
End 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1
Addres
s
RAM has 17FF
00010 H b, hence it requires Y2 output of
decoder.
31 31
Memory Interfacing: Example 1 Implementation
Step-
5: R
D
IO/
M
A0 -
W O
E A10
R
R
D
EPROM
D0
-
Y 000 D7
00 To
A15 Y
0
000 EPROM
A14 1
Y 01 To D0 – A0 -
A13 5:32 000
Decoder 2 10 RAM D7 A10
A12 O RAM
E
A11
32
32
33
Memory Interfacing: Example 2
Interface 16kB of EPROM with chip size of 8kB and starting address from 0000H and 8kB of RAM with
starting address followed by EPROM.
Step-1:
Total EPROM required =16kB
Chip size available = 8kB
No. of chips required = 16kB/8kB = 2
34
Memory Interfacing: Example 2
Step-2: EPROM Chip-1:
Starting Address = 0000H
Chip Size = 8kB (i.e. address Line=13, m/m=213 =8192B =8k)
Ending Address = 1FFFH
EPROM Chip-2:
Starting Address =1FFFH + 1 = 2000H
Chip Size = 1FFFH
Ending Address = 2000+1FFFH = 3FFFH
35
Memory Interfacing: Example 2
Step-3: RAM Chip-1:
Starting Address = EPROM ending address + 1
Starting Address = 3FFFH+1 = 4000H
Chip Size = 8kB (i.e. address Line =13, m/m=213 = 8192B =8k)
Chip Size = 1FFFH
Ending Address = 4000h+1FFFH = 5FFFH
36 36
Memory Interfacing: Example 2
Step-4: Memory A A A A A A A A A A A A A A A A
Map 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Start
Address 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 0000 H
M1 End
Address
1FFF H
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
Start
Address 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 2000 H
M End
2 Address 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
3FFF H
Start
Address 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4000 H
RAM End
Address 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1
5FFF H
37
Memory Interfacing: Example 2
Step-5:Interface Implementation
• EPROM chip size = RAM chip size = 8kB = 213
• Therefore, neglect lower 13 address lines (i.e. A 0 to A12) and consider only A13 to
A15 for decoding.
Y7
38 38
Memory Interfacing: Example 2
Step-4: Memory A A A A A A A A A A A A A A A A
Map 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Start
Address 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 0000 H
M1 End
Address
1FFF H
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
Start
Address 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 2000 H
M End
2 Address 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
3FFF H
Start
Address 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4000 H
RAM End
Address 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1
5FFF H
39 39
Memory Interfacing: Example 2 Implementation
Step-5:
RD
A0 - A12
OE
IO/M
EPROM
CHIP-1
WR D0
RD -
D7
D0 – D7 A0 - A12
OE RAM
40
Exercise: Memory Interface Example
1. Draw the interfacing of a 4KB EPROM having a starting address 2000h and two 2KB static RAMs
having starting addresses 4000h and 8000h, respectively, with 8085 microprocessor.
2. Design an 8085 microprocessor system such that it should contain 16KB of EPROM and 4KB of RAM
with starting addresses 0000H and 4000H respectively. Use two 8KB of EPROMs (2764) and two 2KB
of RAMs (6116) for this system.
41 41
Exercise: Example 1
Step-4: Memory A A A A A A A A A A A A A A A A
Map 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Start
Address 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 2000 H
M1 End
Address
2FFF H
0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1
Start
Address 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4000 H
RAM 1 End
Address 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1
47FF H
Start
Address 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8000 H
RAM 2 End
Address 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1
87FF H
42 42
Exercise: Example 1
Step-5:
RD
A0 - A12
OE
IO/M
EPROM
CHIP
WR D0
RD -
D7
D0 – D7 A0 - A12
Y0 00100 OE
To EPROM
Y1 RAM-1
00101
A15
Y2 To RAM-1
A14 5:32 01000
A13 Decoder
Y3 To RAM-2
A12 10000
D0 – D7 A0 - A12
A11
OE RAM-2
43
Exercise: Example 2
Step-4: Memory A A A A A A A A A A A A A A A A
Map 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Start
Address 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 0000 H
M1 End
Address
1FFF H
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
Start
Address 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
EPRO 2000 H
M2 End
Address 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
3FFF H
Start
Address 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4000 H
RAM 1 End
Address 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1
47FF H
Start
Address 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0
4800 H
RAM 2 End
Address 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1
4FFF H
44
Exercise: Example 2
Step-5: A0 - A10
RD OE
IO/M D0 EPROM-1
-
D7
WR
RD A0 - A10
OE
D0 EPROM-2
-
D7
Y0 00011
EPROM-1
Y 00000
1
D0 – D7 A0 - A10
A15 00100 OE
RAM-1
A14 5:32 EPROM-2
Y2 00111
A13 Decoder
A12 Y3 01000 To RAM-1
A11
A0 - A10
Y4 10000 To RAM-2
D0 – D7
OE RAM-2
45
IO Interfacing
46
8085 Interfacing Pins
Following is the list of 8085 pins used for interfacing with other
devices:
3. ALE
4. RD
5. WR
6. READY
47 47
Ways of Communication with Microprocessor
There are two ways of communication in which the microprocessor can connect with the outside
world.
1. Serial Communication Interface
In this type of communication, the interface gets a single bit of data from the microprocessor
and sends it bit by bit to the other system serially and vice-a-versa.
48 48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
PROF. SUNAYANA DOMADIA DIGITAL FUNDAMENTALS (3130704) 75
PROF. SUNAYANA DOMADIA DIGITAL FUNDAMENTALS (3130704) 76