Module - II B
Module - II B
By
Dr. J.KRISHNA CHAITHANYA
ASSOCIATE PROFESSOR
DEPT. OF ECE
VCE, SHAMSHABAD – 501 218.
Contents at a glance
•8086 addressing
•Address decoding
•Interfacing RAM, ROM, EPROM to 8086
•Direct Memory Access (DMA) Data Transfer
•Interface 8257 DMA controller
8086 ADDRESSING
Address space: It refers to set of all addresses that can be generated by
the microprocessor. There are 2 types of address spaces. They are: I/O
Address space, Memory address space.
Memory mapped I/O: When designing with microprocessors that
provide only one address space for both I/O, memory and the I/O
device locations are assigned addresses from the memory address
space itself.This is known as memory mapped I/O.
I/O
EPROM
RAM
13
8086 addressing and address decoding
14
8086 addressing and address decoding
Every microprocessor based system has a memory system.
Almost all systems contain two basic types of memory, read only
memory (ROM) and random access memory (RAM) or read/write
memory.
ROM contains system software and permanent system data such as
lookup tables, IVT..etc.
RAM contains temporary data and application software.
ROMs/PROMs/EPROMs are mapped to cover the CPU’s reset address,
since these are non-volatile.
When the 8086 is reset, the next instruction is fetched from the
memory location FFFF0H.
So in the 8086 system the location FFFF0H must be in ROM location.
15
8086 addressing and address decoding
Address Decoding Techniques
1. Absolute decoding
2. Linear decoding
3. Block decoding
1. Absolute Decoding:
In the absolute decoding technique the memory chip is selected only for the
specified logic level on the address lines: no other logic levels can select the
chip.
Below figure the memory interface with absolute decoding. Two 8K EPROMs
(2764) are used to provide even and odd memory banks.
Control signals BHE and A0 are use to enable output of odd and even memory
banks respectively. As each memory chip has 8K memory locations, thirteen
address lines are required to address each locations, independently.
All remaining address lines are used to generate an unique chip select signal.
This address technique is normally used in large memory systems.
16
Absolute Decoding:
17
8086 addressing and address decoding
Linear Decoding:
In small system hardware for the decoding logic can be eliminated
by using only required number of addressing lines (not all).
Other lines are simple ignored. This technique is referred as linear
decoding or partial decoding. Control signals BHE and A0 are used
to enable odd and even memory banks, respectively. Figure shows
the addressing of 16K RAM (6264) with linear decoding.
The address line A19 is used to select the RAM chips. When A19 is
low, chip is selected, otherwise it is disabled.
The status of A14 to A18 does not affect the chip selection logic.
This gives you multiple addresses (shadow addresses).
This technique reduces the cost of decoding circuit, but it gas
drawback of multiple addresses.
18
Linear Decoding:
19
8086 addressing and address decoding
Block Decoding:
In a microcomputer system the memory array is often consists of
several blocks of memory chips.
Each block of memory requires decoding circuit. To avoid
separate decoding for each memory block special decoder IC is
used to generate chip select signal for each block.
Figure shows the Block decoding technique using 74138, 3:8
decoder
20
Block Decoding:
21
Interfacing RAM, ROM and EPROM
• The semiconductor memories are arranged as two dimensional arrays of
memory locations.
For example, 1K X 8 memory chip contains 1024 locations and each of
them is one byte wide. i.e. 1024 bytes of information can be stored in that chip .
Each location should have an address. So, there has to be certain number of
address lines on the memory chips.
• If we designate it as n, then n = logN, where N is the number of locations that
could be addresses in that chip. For 1K chip n would be 10, for 2K it is 11, for 4k
it will be 13 etc
I. ROM
•PROM
•EPROM( versions-- EPROM 2704-size(512 bytes),EPROM 2708-
size(1KB), EPROM 2716-size(2 KB), EPROM 2764-size(8 KB))
•EEPROM
II. RAM
•Static RAM
•Dynamic RAM
ROM and EPROM
• ROMS and EPROMs are the simplest memory chips to
interface to the 8086. 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 chips 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.
• To interface the ROMs/RAMs directly to the 8086-
multiplexed bus, they must have output enable signals. The
figure below shows the 8086 interfaced to two 2716s.
• Byte accesses are obtained by reading the full 16-bit word
onto the bus with the 8086 discarding the unwanted byte and
accepting the desired byte.
ROM pin diagram & Two ROM’s
connected in parallel
Interfacing of ROM/EPROM
Static RAMS
• First we have to write the memory map for the problem given. It reveal the
logic to be used for decoding circuit.
• Since the first instruction is fetched from FFFF0h after the microprocessor
is reset, we will make that address to be present in EPROM and write the
memory map as above. And, to avoid windowing let us keep the locations to
be present in the RAM as immediate addresses.
• Locations having addresses from FFFFFH to FE000H are allocated to
EPROM1 and 2. Immediate address map FDFFFH to FD000H is allocated to
RAM1 and 2. The line which is differentiating EPROM from RAM is A13. Let
us use it along with A0 and BHE to identify odd and even banks.
Interfacing diagram for above given problem
Problem2: Design an interface between 8086 CPU and two chips of
16K×8 EPROM and two chips of 32K×8 RAM. Select the starting
address of EPROM suitably. The RAM address must start at 00000 H.
Solution:
•The last address in the map of 8086 is FFFFF H. after resetting, the
processor starts from FFFF0 H. hence this address must lie in the
address range of EPROM.
•It is better not to use a decoder to implement the above map
because it is not continuous, i.e. there is some unused address space
between the last RAM address (0FFFF H) and the first EPROM address
(F8000 H). Hence the logic is implemented using logic gates.
Problem3: It is required to interface two chips of 32K×8 ROM and four
chips of 32K×8 RAM with 8086, according to following map.
ROM 1 and ROM 2 F0000H - FFFFFH, RAM 1 and RAM 2 D0000H -
DFFFFH, RAM 3 and RAM 4 E0000H - EFFFFH. Show the
implementation of this memory system.
Solution:
INTERFACING I/O PORTS
•I/O ports or Input/output ports are the devices through which the
microprocessor communicates with other devices or external data
source/destinations.
•Input activity, as one may expect, is the activity that enables the
microprocessor to read data from external devices, and for example
keyboards. These devices are known as input devices as they feed data into
microprocessor system.
•Output activity transfers data from the microprocessor to the external
devices, for example CRT display. These devices which accept the data from
a microprocessor system are called output devices.
•Thus for a microprocessor the input activity is similar to read operation,
while the output activity is similar to write operation.
Steps in Interfacing an I/O Device
•Connect the data bus of the microprocessor system with the data bus of
the I/O port.
•Derive a device address pulse by decoding the required address of the
device and use it as the chip select of the device.
•Use a suitable control signal i.e. IORD and IOWR to carry out device
operations.
Memory Mapping I/O mapping
1. 20-bit addresses are provided for IO 1. 8-bit or 16-bit address are provided
devices. for IO devices
3. In memory mapped ports, the data 3. In IO mapped ports, the data transfer
can be moved from any register to can take only between the
port and vice versa accumulator and the ports