Professional Documents
Culture Documents
Unit 2
Unit 2
Unit 2
Memory interfacing
Course Instructor
Dr. Vishal Moyal
Contents
What is an Interface?
AddressLines
Control Lines
Interface
Department of Electrical Engineering
Shri Vile Parle Kelavani Mandal’s Institute of Technology, Dhule
Buses of 8085
• Address Bus
– Used to address memory & I/Odevices
– 8085 has a 16-bit address bus
Higher-orderAddress Lower-orderAddress
A15 A14 A13 A12 A11 A10 A9 A8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0
• Data Bus
– Used to transfer instructions and data
– 8085 has a 8-bit data bus
Department of Electrical Engineering
Shri Vile Parle Kelavani Mandal’s Institute of Technology, Dhule
Types of Memory
ROM
PROM
EPROM
EEPROM
SRAM
DRAM
Basic DRAM
Tri-State Buffers
Enable Enable
Enable
EN
WR RD
Enable
EN
A Memory Register
D D D D
Q Q Q Q
EN EN EN EN
EN
RD O0 O1 O2 O3
o o
D1
o
D2
o
D3
EN EN EN EN
DQ DQ DQ DQ
EN EN EN EN
DQ DQ DQ DQ
EN EN EN EN
DQ DQ DQ DQ
EN EN EN EN
o o o o
RD
I0 I1 I2 I3
WR Input Buffers
Output Buffers
RD
O0 O1 O2 O3
• So, the previous diagram would now look like the as following
I0 I1 I2 I3
WR Input Buffers
A D Memory Reg. 0
d e
A1 d c Memory Reg. 1
r o
e d Memory Reg. 2
A0
s e Memory Reg. 3
s r
RD Output Buffers
O0 O1 O2 O3
• Since we have tri-state buffers on both the inputs and outputs of the
flip flops, we can actually use
The
A D chipMemory
d e
would Reg. 0 now D0
A1
look
d c li
r o
Memory Reg. 1 D1 A1 D1
e d Memory Reg. 2 D2 D2
A0 A0
s e Memory Reg. 3
s r D3 D3
RD Output Buffers
RD WR
Dimensions of Memory
• Memory is usually measured by two numbers: its length and its width
(Length X Width).
• The length is the total number of locations.
• The width is the number of bits in each location.
• The length (total number of locations) is a function of the number of
address lines.
• # of memory locations = 2( # of address lines)
• So, a memory chip with 10 address lines would have
• 210 = 1024 locations (1K)
• Looking at it from the other side, a memory chip with 4K locations would
need
• Log2 4096=12 address lines
Department of Electrical Engineering
Shri Vile Parle Kelavani Mandal’s Institute of Technology, Dhule
Chip Select
WR
D0
D1
RD WR RD WR RD WR RD WR
A0 A0 A0 A0
A1 A1 A1 A1
CS CS CS CS
A0
A1
A2 2 X4
A3 Decoder
F7FF
FFFF
• The address range of a particular chip is the list of all addresses that
are mapped to the chip.
• An example for the address range and its relationship to the memory
chips would be the Post Office Boxes in the post office.
• Each box has its unique number that is assigned sequentially (memory
locations).
• The boxes are grouped into groups (memory chips).
• The first box in a group has the number immediately after the last box
in the previous group.
• The 8085 has 16 address lines. So, it can address a total of 64K
memory locations.
• If we use memory chips with 1K locations each, then we will need 64
such chips.
• The 1K memory chip needs 10 address lines to uniquely identify the
1K locations. (log21024 = 10)
• That leaves 6 address lines which is the exact number needed for
selecting between the 64 different chips (log2 64 = 6).
• Now, we can break up the 16-bit address of the 8085 into two pieces:
A11
A12 CS
A13
A14
A15
A 11
A 12 CS
A 13
A 14
A 15
• Now the chip would have addresses ranging from: 2400 to 27FF.
• Changing the combination of the address bits connected to the chip
select changes the address range for the memory chip.
Department of Electrical Engineering
Shri Vile Parle Kelavani Mandal’s Institute of Technology, Dhule
2000
23FF 2400
27FF
FFFF FFFF
Data Lines
• All of the above discussion has been regarding memory length.
• Lets look at memory width.
• We said that the width is the number of bits in each memory word.
• We have been assuming so far that our memory chips have the right width.
• What if they don’t?
• It is very common to find memory chips that have only 4 bits per
location. How would you design a byte wide memory system using
these chips?
• We use two chips for the same address range. One chip will supply 4 of
the data bits per address and the other chip supply the other 4 data bits
for the same address.
Department of Electrical Engineering
Shri Vile Parle Kelavani Mandal’s Institute of Technology, Dhule
Data Lines
CS
A0
…
A9
CS CS
D0
…
D3
D4
…
D7
Address decoders
2 to 4decoder
O0 CS Memory 1
A12 S1 O1 CS Memory 2
A11 S0 O2 CS Memory 3
O3 CS Memory 4
E
A13
A10 - A0
8085
A15-A8 CS
ALE
A9-A0 1K Byte
AD7-AD0 Latch Memory
A7-A0 Chip
WR RD IO/M D7-D0
RD WR
Absolute Decoding
• In this type of scheme all the 16 bits of the 8085 address bus are used
to select a particular location in memory chip.
• Advantages:
• Complete Address Utilization
• Ease in Future Expansion
• No Bus Contention, as all addresses are unique.
• Disadvantages
• Increased hardware and cost.
• Speed is less due to increased delay.
Partial Decoding
• There are two ways to interface 8085 with I/O devices in parallel data
transfer mode:
• Memory Mapped I/O
• I/O Mapped I/O
Absolute Decoding
Partial Decoding
Example 1
• Identify the scheme of
interfacing.
Example 2
• Identify the scheme of
interfacing.
Parallel Transmission
• In Parallel Transmission, various bits are sent together simultaneously with
a single clock pulse.
• It is a fast way to transmit as it uses many input/output lines for transferring
the data.
• The basic difference between a parallel and a serial communication channel
is the number of electrical conductors used at the physical layer to convey
bits.
• Parallel communication implies more than one such conductor.
• For example, an 8-bit parallel channel will convey eight bits (or a byte)
simultaneously, whereas a serial channel would convey those same bits
sequentially, one at a time. If both channels operated at the same clock
speed, the parallel channel would be eight times faster.
Department of Electrical Engineering
Shri Vile Parle Kelavani Mandal’s Institute of Technology, Dhule
Parallel Transmission …
• In order to transmit n bits, n wires or
lines are used. Thus each bit has its
own line.
• All n bits of one group are transmitted
with each clock pulse from one device
to another i.e. multiple bits are sent
with each clock pulse.
• Parallel transmission is used for short
distance communication.
• Programmable I/O is the most simple type of I/O technique for the
exchanges of data or any types of communication between the
processor and the external devices.
• The processor executes a program that gives it direct control of the I/O
operation, including sensing device status, sending a read or write
command, and transferring the data.
• When the processor issues a command to the I/O module, it must wait
until the I/O operation is complete.
• If the processor is faster than the I/O module, this is wasteful of
processor time.
Synchronous Mode
• Synchronous means “at the same time” i.e. the device which sends the
data and the device which receives the data are synchronized with the
same clock speed.
• This technique of data transfer can be employed when the speed of I/O
devices and the speed of CPU are compatible.
• This technique can also be used when the speed characteristic of the
I/O devices are known, so we can delay the data transfer for a fixed
time.
• When the device is ready with the data it can indicate to 8085 on the
READY pin.
Asynchronous Mode
Asynchronous Mode …
Asynchronous Mode
• In this interrupt driven I/O data transfer method the I/O device informs
the microprocessor for the data transfer whenever the I/O device is
ready.
• This is achieved by interrupting the microprocessor by using the
interrupt pins of microprocessor.
• Without the DMA channels, the CPU copies every piece of data using
the peripheral bus from the I/O device which does not allow the
microprocessor to perform other work until the operation is completed.
• With DMA, the CPU can process other tasks while data transfer is
being performed.
• The transfer of data is first initiated by the CPU. During the transfer of
data between the DMA channel and I/O device, the CPU performs
other tasks.
• When the data transfer is complete, the CPU receives an interrupt
request from the DMA controller.
• It is the fastest DMA mode. In this two or more data bytes are
transferred continuously i.e. entire block of data is transferred in one
contiguous sequence.
• Processor is disconnected from system bus during DMA transfer.
• N number of machine cycles are adopted into the machine cycles of
the processor where N is the number of bytes to be transferred.
• So once the DMA controller is granted access to the system bus by the
CPU, it transfer all bytes of data in the data block before releasing
control of the system buses back to the CPU.
• After receiving HLDA signal, DMA gains control of system bus and
transfers one byte.
• After transferring one byte, it increments memory address, decrements
counter and transfers next byte.
• In this way, it transfer all data bytes between memory and I/O devices.
• After transferring all data bytes, the DMA controller disables HOLD
signal & enters into slave mode.
• If count is not zero and data is available then the DMA controller
again sends HOLD signal to the processor and transfer next byte of
data block.
• By continually obtaining and releasing the control of the system bus,
the DMA controller essentially interleaves instructions and data
transfers.
Serial Communication
Serial Communication …