Download presentation
Presentation is loading. Please wait.
Published byDoris Clarke Modified over 5 years ago
1
Department of Electronics and Communication Engineering
Microprocessor and Microcontroller(A3419) Unit – II 8086 MEMORY INTERFACING T. RAMAKRISHNAIAH Associate Professor Department of Electronics and Communication Engineering VARDHAMAN COLLEGE OF ENGINEERING Shamshabad, Hyderabad – , India.
2
8086 addressing and address decoding
Most of the memory ICs are byte oriented i.e., each memory location can store only one byte of data. The 8086 is a 16-bit microprocessor, it can transfer 16-bit data. So in addition to byte, word (16-bit) has to be stored in the memory. To implement this , the entire memory is divided into two memory banks: Bank0 and Bank1. Bank0 is selected only when A0 is zero and Bank1 is selected only when BHE’ is zero. A0 is zero for all even addresses, so Bank0 is usually referred as even addressed memory bank. BHE’ is used to access higher order memory bank, referred to as odd addressed memory bank.
3
8086 addressing and address decoding
4
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.
5
8086 addressing and address decoding
Address Decoding Techniques Absolute decoding Linear decoding 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.
6
Absolute Decoding:
7
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.
8
Linear Decoding:
9
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
10
Block Decoding:
11
Interfacing RAM, ROM, EPROM to 8086
The general procedure of static memory interfacing with 8086 Arrange the available memory chips so as to obtain 16-bit data bus width. The upper 8-bit bank is called ‘odd address memory bank’. 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 RD and WR inputs to the corresponding processor control signals. Connect the 16-bit data bus of memory bank with that of the microprocessor 8086. The remaining address lines of the microprocessor, BHE and A0 are used for decoding the required chip select signals for the odd and even memory banks. The CS of memory is derived from the output of the decoding circuit.
12
Memory Memories are classified as follows
Semiconductor memory Magnetic memory Optical Memory Semiconductor memories are of two types, RAM (Random Access Memory) ROM (Read Only Memory). The semiconductor RAMs are of broadly two types- Static RAM and Dynamic RAM. The semiconductor memories are organized as two dimensional arrays of memory locations. For example, 4Kx8 or 4K byte memory contains 4096 locations, where each location contains 8-bit data and only one of the 4096 locations can be selected at a time.
13
Static RAM Interfacing
The general procedure of static memory interfacing with 8086 is briefly described as follows: Arrange the available memory chips so as to obtain 16-bit data bus width. 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 𝑅𝐷 and 𝑊𝑅 inputs to the corresponding processor control signals. Connect 16-bit data bus of the memory bank with that of the microprocessor 8086. The remaining address lines of the microprocessor, 𝐵𝐻𝐸 and A0 are used for decoding the required chip select signals for the odd and even memory banks. The 𝐶𝑆 of memory is derived from the O/P of the decoding circuit.
14
Relation between number of address pins and memory capacity
15
Interface two 4Kx8 EPROM and two 4Kx8 RAM chips with 8086
Interface two 4Kx8 EPROM and two 4Kx8 RAM chips with Select suitable maps. Solution: We know that, after reset, the IP and CS are initialized to form address FFFF0H. Hence, this address must lie in the EPROM. The address of RAM may be selected anywhere in the 1MB address space of 8086, but we will select the RAM address such that the address map of the system is continuous.
16
Memory Chip Selection Table
Decoder I/P --> Address/ 𝐵𝐻𝐸 --> A2 A13 A1 A0 𝐵𝐻𝐸 Selection/ Comment Word transfer on D0 - D15 Even and odd address in RAM Byte transfer on D7 - D0 1 Only even address in RAM Byte transfer on D8 - D15 Only odd address in RAM Only odd address in ROM
17
Memory design
18
Problem 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 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.
19
Memory Design
20
Problem 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. Memory map
21
Memory Design
22
Methods of Interfacing I/O Devices
Memory Mapped IO IO mapped IO 20-bit addresses are provided for IO devices. 16-bit address are provided for IO devices 2. The IO ports or peripherals can be treated like memory locations and so all instructions related to memory can be used for data transfer. 2. Only IN and OUT instructions can be used for data transfer between IO device and the processor. 3. In memory mapped ports, the data can be moved from any register to port and vice versa 3. In IO mapped ports, the data transfer can take only between the accumulator and the ports 4. When memory mapping is used for IO devices, the full memory address space cannot be used for addressing memory. 4. When IO mapping is used for IO devices, then the full address space can be used for addressing memory.
23
Interfacing and Refreshing Dynamic RAMs
For small systems we need only a few kilobytes of RAM, we usually use static RAM devices because they are very easy to interface to. For large systems we want several hundred kilobytes or mega bytes of memory, we use dynamic RAMs, often called DRAMs. Static RAMs store each bit in an internal flip flop which requires four to six transistors. In DRAMs a data bit is stored as a charge or no charge on a tiny capacitor. All that is needed in addition to the capacitor is a single transistor switch to access the capacitor when a bit is written to it or read from it.
24
Interfacing and Refreshing Dynamic RAMs
The result of this is that DRAMs require much less power per bit, many more bits can be stored in a given chip. This makes cost per bit of storage much less. The disadvantage of DRAMs is that each stored bit must be refreshed because the charge stored on the tiny capacitors tends to change due to leakage. The process of refreshing the data in the RAM is known as refresh cycle. This activity is similar to reading the data from each cell of the memory and write back, independent of the requirement of microprocessor, regularly.
25
Interfacing and Refreshing Dynamic RAMs
During this refresh period all other operations related to the memory subsystem are suspended. Hence the refresh activity causes loss of time, resulting in reduce system performance. However keeping in view the advantages of dynamic RAM, like low power consumption, high packaging density and low cost, most of the advanced computing system are designed using dynamic RAM, at the cost of operating speed. A dedicated hardware chip called as dynamic RAM controller is the most important part of the interfacing circuit.
26
Interfacing and Refreshing Dynamic RAMs
Generally dynamic RAM is available in units of several Kilobits to even Megabits of memory (note that it is not in terms bytes or nibbles as in a static RAM). This memory is arranged internally in a two dimensional matrix array so that it will have n rows and m columns. The diagram shown in figure explains the refreshing logic and interfacing with dynamic RAM. Each of the used chips 16K * 1-bit Dynamic RAM cell array. The system contains two 16 Kbytes Dynamic RAM units. All the address and the data lines are assumed to be available from an 8086 microprocessor system. The OE pin controls output data buffers of the memory chip.
27
Interfacing and Refreshing Dynamic RAMs
28
Interfacing and Refreshing Dynamic RAMs
The CE pins are active high chip select of memory chips. The refresh cycle starts, if refresh output of the refresh timer goes high, OE’ and CE also tends to go to high. The high CE enables the memory chip for refreshing, while high OE’ prevents the data from appearing on the data bus. The 16K×1- bit dynamic RAM has an internal array of 128×128 cells, requiring 7 bits for row addresses. The lower order seven lines A0-A6 are multiplexed with refresh counter output A10-A16.
29
Interfacing and Refreshing Dynamic RAMs
The following are the main tasks to interface a bank of DRAMs to a microprocessor: 1. Multiplex the two halves of the address into each device with the appropriate RAS and CAS strobes. 2. Provide a read/write control signal to enable data into or out of the devices. 3. Refresh each row at the proper interval. 4. Ensure that a read or write operation and refresh operation do not take place at the same time.
30
Direct Memory Access (DMA) Data Transfer
Direct Memory Access (DMA) is a feature of modern computer systems that allows certain hardware subsystems to read/write data to/from memory without microprocessor intervention, allowing the processor to do other work. For facilitating DMA type of data transfer between several devices, a DMA controller may be used.
31
Direct Memory Access (DMA) Data Transfer
32
Direct Memory Access (DMA) Data Transfer
DMA series of steps when peripheral is sending data through DMA controller to memory: DREQ(from peripheral drive to DMA controller) HRQ(from DMA controller to 8086 HOLD pin) HLDA (from 8086 to DMA controller) DMA controller takes control over system buses DACK(from DMA controller to peripheral drive) Peripheral Starts copying data to memory
33
DMA CONTROLLER 8257 Features of 8257
It is a programmable, 4-channel direct memory access controller. Each channel can be programmed individually. Therefore we can interface 4 input/output devices with 8257. Each channel includes a 16-bit DMA address register and a 14-bit counter. DMA address register gives the address of memory location and counter specifies the number of DMA cycles to be performed. As counter is 14-bit each channel can transfer 214(16 kb) without intervention of microprocessor. It maintains the DMA cycle count for each channel and activates a control signal TC(terminal count) to indicate the peripheral that the programmed number of DMA cycles are complete.
34
DMA CONTROLLER 8257 Features of 8257
It provides another control signal MARK to indicate peripheral that the current DMA cycle is the 128th cycle since the previous MARK output. It has the priority logic that resolves the peripheral requests. The priority logic can be programmed to work in two modes, either in fixed mode or rotating priority mode. It provides inhibit logic which can be used to inhibit individual channels. It allows data transfer in two modes: burst mode and cycle steal(single byte) mode.
35
DMA CONTROLLER 8257 Features of 8257
It can execute three DMA cycles: DMA read, DMA write and DMA verify. Auto load feature of 8257 permits repeat block or block chaining operations. It operates in two modes: slave and master. It can be interfaced with all Intel microprocessors. It can transfer one byte of data in four clock cycles. Thus giving high transfer rate. When DMA is in master mode, AEN signal provided by 8257 allows to isolate CPU buffers, latches and other devices from system bus.
36
DMA CONTROLLER 8257 ARCHITECTURE
37
8257 Register Selection
38
System Application Example
39
DMA CONTROLLER 8257 Data Bus Buffer:
It is a bi-directional, eight bit buffer which interfaces the 8257 to the system bus. In the slave mode, it is used to transfer data between microprocessor and internal registers of 8257. In master mode it is used to send higher byte address (A8-A15) on the data bus.
40
DMA CONTROLLER 8257 Read/Write Logic:
When the CPU is programming or reading one of the internal registers of 8257(slave mode), the Read/Write logic accepts the I/O Read or I/O write signal, decodes the least significant four address bits(A0-A3) and either writes the contents of data bus into the address register or places the contents of address register onto the data bus. During DMA cycles(master mode) the Read/Write logic generates the I/O read and memory write(DMA write cycle) or I/O write and memory read(DMA read cycle signals which control the data transfer between peripheral and memory devices.
41
DMA CONTROLLER 8257 DMA Channels:
The 8257 provides four identical channels labeled CH0 to CH3. each channel has two sixteen bit registers: A DMA address register A terminal count register DMA Address Register: It specifies the address of first memory location to be accessed. It is necessary to load valid memory address in the DMA address register before channel is enabled.
42
DMA CONTROLLER 8257 Terminal Count Register:
43
DMA CONTROLLER 8257 Terminal Count Register:
The value loaded into lower order 14 bits(C13-C0) of the terminal count register specifies the number of DMA cycles minus one before the terminal count(TC) output is activated. The most significant 2 bits of the terminal count register specifies the type of DMA operation to be performed. It is necessary to load count for DMA cycles and operational code for valid DMA cycle in the terminal count register before channel is enabled.
44
DMA CONTROLLER 8257 Control Logic:
It controls the sequence of operations during all DMA cycles(DMA write, DMA read, DMA verify) by generating the appropriate control signals and the 16-bit address that specifies the memory location to be accessed. It consists of two registers Mode Set Register is programmed by CPU to configure 8257 Status Register is read by CPU to check which channels have reached terminal count condition and status of update flag.
45
DMA CONTROLLER 8257 Mode Set Register:
Least significant four bits of Mode Set Register allows to enable each of the four DMA channels. Most significant four bits allows four different options for the 8257.
46
DMA CONTROLLER 8257 Status Register:
The TC status bit, if one indicates terminal count has been reached for that channel. The TC bit remains set until the status register is read or the 8257 is reset.
47
DMA CONTROLLER 8257 The update flag bit, if one indicates CPU that 8257 is executing update cycle. In update cycle 8257 loads parameters in channel3 to channel2. Priority Resolver: It resolves the peripherals requests. It can be programmed to work in two modes Fixed Mode Rotating Priority Mode
48
DMA CONTROLLER 8257 Operating Modes of 8257
In rotating priority mode, the priority of the channels has a circular sequence. In this channel being serviced gets the lowest priority and the channel next to its gets the highest priority. In the fixed priority channel0 has the highest priority and channel3 has lowest priority. The extended write option provides alternative timing for the I/O and memory write signals which allows the devices to return an early READY and prevents the unnecessary occurrence of wait states in 8257.
49
DMA CONTROLLER 8257 Operating Modes of 8257
If the TC STOP, bit is set, a channel is disabled after the terminal count output goes high thus automatically preventing further DMA operations on that channel. Auto Load Mode when enabled, permits block chaining operations, without immediate software intervention between blocks. During the update cycle, it is necessary to prevent the CPU from inadvertently skipping a data block by overwriting a starting address or terminal count in the channel3 registers before those parameters are properly auto-loaded into channel2.
50
DMA CONTROLLER 8257 PIN DIAGRAM
51
PIN Diagram Description
DRQ0-DRQ3: These are the four individual channel DMA request inputs, used by the peripheral devices for requesting the DMA services. The DRQ0 has the highest priority while DRQ3 has the lowest one, if the fixed priority mode is selected. DACK0-DACK3: These are the active-low DMA acknowledge output lines which inform the requesting peripheral that the request has been honoured and the bus is relinquished by the CPU. These lines may act as strobe lines for the requesting devices.
52
PIN Diagram Description
D0-D7: These are bidirectional, data lines used to interface the system bus with the internal data bus of These lines carry command words to and status word from 8257, in slave mode, i.e. under the control of CPU. The data over these lines may be transferred in both the directions. When the 8257 is the bus master (master mode, i.e. not under CPU control), it uses D0-D7 lines to send higher byte of the generated address to the latch. This address is further latched using ADSTB signal. the address is transferred over D0-D7 during the first clock cycle of the DMA cycle. During the rest of the period, data is available on the data bus.
53
PIN Diagram Description
IOR: This is an active-low bidirectional tristate input line that acts as an input in the slave mode. In slave mode, this input signal is used by the CPU to read internal registers of 8257.this line acts output in master mode. In master mode, this signal is used to read data from a peripheral during a memory write cycle. IOW: This is an active low bidirection tristate line that acts as input in slave mode to load the contents of the data bus to the 8-bit mode register or upper/lower byte of a 16-bit DMA address register or terminal count register. In the master mode, it is a control output that loads the data to a peripheral during DMA memory read cycle (write to peripheral).
54
PIN Diagram Description
CLK: This is a clock frequency input required to derive basic system timings for the internal operation of 8257. RESET: This active-high asynchronous input disables all the DMA channels by clearing the mode register and tristates all the control lines. A0-A3: These are the four least significant address lines. In slave mode, they act as input which select one of the registers to be read or written. In the master mode, they are the four least significant memory address output lines generated by 8257. CS: This is an active-low chip select line that enables the read/write operations from/to 8257, in slave mode. In the master mode, it is automatically disabled to prevent he chip from getting selected (by CPU) while performing the DMA operation. A4-A7: This is the higher nibble of the lower byte address generated by 8257 during the master mode of DMA operation.
55
PIN Diagram Description
READY: This is an active-high asynchronous input used to stretch memory read and write cycles of by inserting wait states. This is used while interfacing slower peripherals.. HRQ: The hold request output requests the access of the system bus. In the non cascaded 8257 systems, this is connected with HOLD pin of CPU. In the cascade mode, this pin of a slave is connected with a DRQ input line of the master 8257, while that of the master is connected with HOLD input of the CPU. HLDA: The CPU drives this input to the DMA controller high, while granting the bus to the device. This pin is connected to the HLDA output of the CPU. This input, if high, indicates to the DMA controller that the bus has been granted to the requesting peripheral by the CPU. MEMR: This active –low memory read output is used to read data from the addressed memory locations during DMA read cycles. MEMW: This active-low three state output is used to write data to the addressed memory location during DMA write operation.
56
PIN Diagram Description
ADST: This output from 8257 strobes the higher byte of the memory address generated by the DMA controller into the latches. AEN: This output is used to disable the system data bus and the control the bus driven by the CPU, this may be used to disable the system address and data bus by using the enable input of the bus drivers to inhibit the non-DMA devices from responding during DMA operations. If the 8257 is I/O mapped, this should be used to disable the other I/O devices, when the DMA controller addresses is on the address bus. Vcc: This is a +5v supply pin required for operation of the circuit. GND: This is a return line for the supply (ground pin of the IC).
57
PIN Diagram Description
TC: Terminal count output indicates to the currently selected peripherals that the present DMA cycle is the last for the previously programmed data block. If the TC STOP bit in the mode set register is set, the selected channel will be disabled at the end of the DMA cycle. MARK: The modulo 128 mark output indicates to the selected peripheral that the current DMA cycle is the 128th cycle since the previous MARK output. The mark will be activated after each 128 cycles or integral multiples of it from the beginning if the data block (the first DMA cycle), if the total number of the required DMA cycles (n) is completely divisible by 128.
58
Problem Interface DMA controller 8257 with 8086 so that the channel 0 DMA address register has an I/O address 80H and the mode set register has an address 88H.Initialize the 8257 with normal priority , TC stop and non–extended write. Autoload is not required. The transfer is to take place using channel 0, write an ALP to move 2KB of data from a peripheral device to memory address 2000:5000h, with the above initialization. MODE SET REGISTER = ? TERMINAL COUNT REGISTER= ?
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.