Memory and I/O Interfacing
1 of 55
Example Block Diagram
Address Lines
Data Lines
8085 Memory
Control Lines
Interface
2
8085 Interfacing Pins
Higher Address Bus A15 – A8
Lower Address/Data Bus AD7 – AD0
8085 ALE
IO/M
RD
WR
READY
3
Address Bus of 8085
• Address Bus
– Used to address memory & I/O devices
– 8085 has a 16-bit address bus
Higher-order Address Lower-order Address
A15 A14 A13 A12 A11 A10 A9 A8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0
Data Bus Data Bus
Used to transfer instructions and data
8085 has a 8-bit data bus
4
Higher Order Address Bus
• The higher order address bus is a unidirectinal
bus.
• It carries most significant 8-bits of a 16-bit
address of memory or I/O device.
• Address remains on lines as long operation is
not completed.
5
Lower Order Address/Data Bus
• This bus is bidirectional and works on time
division multiplexing between address and
data.
• During first clock cycle, it serves as a least
significant 8-bits of memory/ IO address.
• For second and third clock cycles it acts as
data bus and carries data.
6
Demultiplexing Address/Data Lines
• 8085 identifies a memory location with its 16
address lines, (AD0 to AD7) & (A8 to A15)
• 8085 performs data transfer using its data
lines, AD0 to AD7
• Lower order address bus & Data bus are
multiplexed on same lines i.e. AD0 to AD7.
• Demultiplexing refers to separating Address &
Data signals for read/write operations.
7
Need for Demultiplexing…
RD
A15 – A8
20H
AD7 – AD0
05H Memory
4FH 2005H
8085
8
9
Demultiplexing Address/Data Lines
Data
74LS373 Memory
8085 AD0-AD7 A0 – A7
ALE
Chip
Control
A8-A15 A8-A15
Memory Interface
10
Generating Control Signals
IO/M =0
1 Memory Read
RD=0 1
1 Memory Write
WR=1
0
0 IO Read
1
0 IO Write
0
11
Generating Control Signals
IO/M =0
1 Memory Read
RD=1 0
1 Memory Write
WR=0
1
0 IO Read
0
0 IO Write
1
12
Generating Control Signals
IO/M =1
0 Memory Read
RD=0 1
0 Memory Write
WR=1
0
1 IO Read
1
1 IO Write
0
13
Generating Control Signals
IO/M =1
0 Memory Read
RD=1 0
0 Memory Write
WR=0
1
1 IO Read
0
1 IO Write
1
14
Memory Interface
• The memory is made up of semiconductor
material used to store the programs and
data. The types of memory is,
– Primary or main memory
– Secondary memory
15
Primary Memory
• RAM and ROM are examples of this type of
memory.
• Microprocessor uses it in storing a program
temporarily (commonly called loading) and
executing a program.
• Hence the speed of this type of memory
should be fast.
16
Secondary Memory
• These are used for bulk storage of data
and information.
• The main examples include Floppy, Hard
Disk, CD-ROM, Magnetic Tape etc.
• Slower and Sequential Access Nature.
• non-volatile nature.
17
Memory Chip
‘k’ data input lines
‘n’ address lines
Chip select
read Memory
write
‘k’ data output lines
18
19 of 55
20 of 55
Interface with two memory chips
A1
A0
11 11
10 10
01 01
00 00
Memory 1 Memory 2
21
Interface with two memory chips
A1
A0
11 011 11 111
10 010 10 110
01 001 01 101
00 000 00 100
A3 CS CS
Memory 1 Memory 2
22
Interface with Multiple Chips
• In case of multiple chips simple circuit
like NOT gate will not work.
• In this case normally decoder circuits like
3-to-8 decoder circuit 74LS138 are used.
• These circuit are called address decoders.
23
Address decoders
2 to 4 decoder
O0 CS Memory 1
A12 S1 O1 CS Memory 2
A11 S0 O2 CS Memory 3
O3 CS Memory 4
E
A13
A10 - A0
24
25 of 55
26 of 55
27 of 55
28 of 55
29 of 55
30 of 55
Interfacing I/O Devices
• Using I/O devices data can be transferred
between the microprocessor and the outside
world.
• This can be done in groups of 8 bits using the
entire data bus. This is called parallel I/O.
• The other method is serial I/O where one bit is
transferred at a time using the SID and SOD
pins on the Microprocessor.
31
Types of Parallel Interface
• There are two ways to interface 8085 with I/O
devices in parallel data transfer mode:
– Memory Mapped IO
– IO Mapped IO
32
Memory Mapped IO
• It considers them like any other
memory location.
– They are assigned a 16-bit address within
the address range of the 8085.
– The exchange of data with these devices
follows the transfer of data with memory.
The user uses the same instructions used
for memory.
33
IO Mapped IO
• It treats them separately from memory.
– I/O devices are assigned a “port number”
within the 8-bit address range of 00H to
FFH.
– The user in this case would access these
devices using the IN and OUT instructions
only.
34
IO mapped IO V/s Memory Mapped IO
Memory Mapped IO IO Mapped IO
• IO is treated as memory. • IO is treated IO.
• 16-bit addressing. • 8- bit addressing.
• More Decoder Hardware. • Less Decoder Hardware.
• Can address 216=64k • Can address 28=256
locations. locations.
• Less memory is available. • Whole memory address
space is available.
35
IO mapped IO V/s Memory Mapped IO
Memory Mapped IO IO Mapped IO
• Memory Instructions are • Special Instructions are
used. used like IN, OUT.
• Memory control signals • Special control signals
are used. are used.
• Arithmetic and logic • Arithmetic and logic
operations can be operations can not be
performed on data. performed on data.
• Data transfer b/w register • Data transfer b/w
and IO. accumulator and IO.
36
37