Meminterfaceececlass
Meminterfaceececlass
Address decoding:
Microprocessor is connected with memory and I/O devices via common address
and data bus. Only one device can send data at a time and other devices can only receive
that data. If more than one device sends data at the same time, the data gets garbled. In
order to avoid this situation, ensuring that the proper device gets addressed at proper
time, the technique called address decoding is used.
In address decoding method, all devices like memory blocks, I/O units etc. are
assigned with a specific address. The address of the device is determined from the way in
which the address lines are used to derive a special device selection signal k/a chip select
(CS). If the microprocessor has to write or to read from a device, the CS signal to that
block should be enabled and the address decoding circuit must ensure that CS signal to
other devices are not activated.
Depending upon the no. of address lines used to generate chip select signal for the
device, the address decoding is classified as:
Depending on the address that are allocated to the device the address decoding are
categorized in the following two groups.
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 27
Microprocessors Chapter 4 : Microprocessor System
If A0 is high and A1- A7 are low and if IOW becomes low, the latch gets enabled.
The data to the LED can be transferred in only one case and hence the device has unique
address of 01H.
Eight I/P switch interfacing at 53H. (01010011)
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 28
Microprocessors Chapter 4 : Microprocessor System
Q) Design an address decoding circuit for two RAM chips each of 256 bytes at address
5300H.
- 256 bytes requires 8 address lines.
2x=256, x=8
So to address one of 256 bytes in each RAM requires 8 address lines A0-A7
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 29
Microprocessors Chapter 4 : Microprocessor System
Q. Draw a circuit diagram to interface two 256 Byte memory chips at address starting at
2050H and 3050H.
Q. Two 4 KB ROM at starting address 0000H
4 KB= 4X1KB = 22 X 210 =212 therefore we need 12 address lines
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 30
Microprocessors Chapter 4 : Microprocessor System
memory requires 13 address lines A0 to A12. So, 8K means 01FFFH bytes, therefore
EPROM address starts from FFFFFH – 01FFFH = FE000H.
Since ROMs and EPROMs are read-only devices, A0 and BHE’ are not required to be
part of the chip enable/select decoding. The 8086 address lines must be connected to the
ROM/EPROM chip starting with A1 and higher to all the address lines of the
ROM/EPROM chips. The 8086 unused address lines can be used as chip enable/select
decoding.
Since static RAMs are read/write memories, both A0 and BHE’ must be included in the
chip select/enable decoding of the devices and write timing must be considered in the
compatibility analysis.
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
Start: 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
End: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Used for Chip Select Address within the 16KB
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 31
Microprocessors Chapter 4 : Microprocessor System
A0 and BHE’ is not used for interfacing of EPROM. Both the 8 KB EPROM chips are selected
whenever any address in the range FC000H – FFFFFH comes on the address bus.
Arrange the available memory chips so as to obtain 16 bits data bus with the upper 8 bit
bank is called “Odd address memory bank” and the lower 8 bit bank is called “Even
address memory bank”.
Connect available memory address lines of memory chips with those of the
microprocessor and also connect the memory RD’ and WR’ inputs to the corresponding
processor control signals. Connect the 16 bit data bus of the memory bank was that of
microprocessor 8086.
The remaining address lines of the microprocessor, BHE’ and A0 are used for loading the
required chip select signals for the odd and even memory banks. The CS’ of the memory
is derived from the O/P of the decoding.
To address 16 KB, we require 14 address lines. Of the 16 KB, 8 KB will be at even addresses
and 8 KB will be at odd addresses. Hence, we use 2 RAM chips, each of 8 KB capacity one for
storing bytes at even address and another for storing bytes for odd address. We will start the
RAM address from 80000H.
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
Start: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
End: 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Block A
Start: 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
End: 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Block B
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 32
Microprocessors Chapter 4 : Microprocessor System
As a good and efficient interfacing practice, the address map of the system should be continuous
as far as possible i.e. these should be no windows and no feedback space should be allowed. A
memory location should have a single address corresponding to it i.e. absolute decoding should
be preferred.
Q) Interface two 4K X 8 EPROMs and two 4K X 8 RAM chips with 8086, select suitable
maps.
We know that, after reset, the IP and CS are initiated to from address FFFF0H. Hence this
address must lie in the EPROM. The address of RAM may be selected anywhere in the 1MB
space of 8086, but we will select the RAM address such that the address map of the system is
continuous as shown in table below.
Address A A A A A A A A A A A A A A A A A A A A
19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FFFFFH 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
EPROM 8K X 8
FE000H 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
FDFFFH 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1
RAM 8K X 8
FC000H 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Total 8K of EPROM need 13 address lines A0-A13 (Since 213 = 8K). Address lines A13-A19 are
used for decoding to generate the chip select. The BHE’ signal goes low when a transfer is at odd
address or higher byte of data is to be accessed, let us assume that the latched address, BHE’ and
de-multiplexed data lines are readily available for interfacing.
The two 4K X 8 chips of RAM and EPROM are arranged in parallel to obtain 16-bit data bus
width. If A0 is 0 i.e. the address is even and is in RAM, then the lower RAM chip is selected
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 33
Microprocessors Chapter 4 : Microprocessor System
indicating 8-bit transfer at even address. If A0 is 1 i.e. the address is odd and is in RAM, the
BHE’ goes low, the upper RAM chip is selected further indicating that the 8 bit transfer is at an
odd address. If the selected addresses are in ROM, the respective ROM chips are selected. If at a
time A0 and BHE’ both are zero, both the RAM or ROM chips are selected i.e. the data transfer
is of 16 bits. The selection of chips takes place as shown in table below.
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 34
Microprocessors Chapter 4 : Microprocessor System
Compiled by: Er. Hari Aryal Email: [email protected] Reference: R. S. Gaonkar & D, V. Hall | 35