Professional Documents
Culture Documents
Memory - IO - 8255 Interfacing
Memory - IO - 8255 Interfacing
8086 Interfacing
with IC
Memory Interfacing-I
1
25-02-2024
Outline
Introduction
Bit/Byte/Word addressable
Memory Interfacing (using NAND)
Memory Interfacing (using decoder)
Examples
References
Introduction
Memory is a storage component in the computer used to store application
programs and data.
The Memory chip is divided into equal parts called as CELLS.
Each Cell is uniquely identified by a binary number called
as “ADDRESS”.
Memory Address Memory
Binary Hex Contents
00-0000-0000 000 10011001
00-0000-0001 001 00111000
00-0000-0010 002 11001001
00-0000-0011 003 00111011
2
25-02-2024
64K x 8 chip has 16 bit Address and cell size = For a 16-bit CPU, 64K x 16 chip has 16 bit
8 bits (1 Byte) which means that in this chip, Address & cell size = 16 bits (Word Length of
data is stored byte by byte. CPU) which means that in this chip, data is stored
word by word.
Memory Interfacing
Memory Interfacing in 8086 is used to access memory by the 8086 for
reading the instruction codes (EPROM) and data stored (RAM) in it.
A memory device or memory chip must have four types of lines:
Address, Data, Control and selection.
3
25-02-2024
Memory Interfacing
Interface an 8088 microprocessor to a single 2716 (2K x 8) EPROM such
that memory starts at address FF800h.
Start Add = FF800h; Size: 2k (800h)
End Add = FF800h + 800h -1= 0FFFFFh
Address range = FF800h - 0FFFFFh
No. of address line = 11 (A0-A10)
Available address lines =20
No. of Chip =1
4
25-02-2024
Memory Interfacing
Interface two 4K x 8 EPROMS and two 4K x 8 RAM chips with
8086. Select suitable chips.
Solution:
The CS and IP are initialized to form address FFFF0h after reset
the processor. Hence, this address must be lie in the EPROM.
Device Size Address No of No of Address Selection Data Bus
Range Address lines lines Selection
used remaining
Memory Interfacing
Chip Hex
Address
A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
4Kx8 FFFFFh 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
ROM (2)
FF000h 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
To ROM IC 2
4Kx8 ROM FEFFFh 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1
(1)
FE000h 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
To ROM IC 1
4K x 8 FDFFFh 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1
RAM (2)
FD000h 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0
To RAM IC 2
4K x 8 FCFFFh 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1
RAM(1)
FC000h 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
To RAM IC 1
5
25-02-2024
Memory Interfacing
Decoder Input (3 x 8) Bank Selected
Decimal Chip
A13 BHE A0
0 0 0 0 EVEN+ODD RAM Chip
(Both)
6
25-02-2024
Memory Interfacing
Memory Interfacing
7
25-02-2024
8
25-02-2024
Memory Interfacing
Memory Interfacing
9
25-02-2024
Memory Interfacing
Design a memory interface for the 8086 which will provide
256k bytes of SRAM, organized as 128k x 16bits, starting at
address 40000H and using 62256 SRAM chips (32k x 8bit).
Assume that 8086 address, data, status, and control busses are
already de-multiplexed and buffered.
We want 128k x 16 bits i.e. 128k x 16bits → 4 chips for both
the high and low banks.
8 chips total
62256 chips are 32k x 8 bit; 32k = 25 x 210 ← 15 address lines
We will use a 2-to-4 decoder (74LS139) to select one out of
four chips from each bank.
10
25-02-2024
Input-Output Interfacing
• The chip 74LS373 is used as an 8 bit Output port. It contains 8 buffered latches to hold
the 8-bit data at the output port till the next change.
• The chip 74LS245 is used as an 8 bit input port. It contains eight tri-state bidirectional
buffer, only one direction (D=1; A (I/P) B (O/P) is useful while using as an input
device.
11
25-02-2024
Input-Output Interfacing
The following steps are performed to interface a general I/O device with
a CPU:
(i) Connect the data bus of the microprocessor system with the data
bus of the I/O port.
(ii) Derive a device address pulse by decoding the required address of
the device and use it as the chip select of the device.
(iii) Use a suitable control signal, i.e. IORD and/or IOWR to carry out
device operations, i. e. Connect IORD to RD input of the device if it is
an input device, otherwise connect IOWR to WR input of the output
device. In some cases the RD or WR control signals are combined
with the device address pulse to generate the device select pulse.
Input-Output Interfacing
Problem 5.6: Interface an input port 74LS245 to read the status of the switches SW1 to SW8.
The switches when shorted input a '1' else input a '0' to the 8086 microprocessor. The store
the status in register BL. The address of the port is 0740H.
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0
12
25-02-2024
Input-Output Interfacing
Problem: Interface an input port 74LS245 to read the status of the switches SW1 to
SW8. The switches when shorted input a '1' else input a '0' to the 8086
microprocessor. Store the status in register BL. The address of the port is 0740H.
MOV BL, 00H ; Clear BL for Status
MOV DX, 0740H ; 16 bit port address in DX
IN AL, DX ; Read port 0740H for the switch positions
MOV BL, AL ; Store the status of switches from AL into BL
HLT ; Stop
• The address, control and data lines are assumed to be readily available at
the microprocessor systems.
• LSB of BL corresponds to the status of SW1 and likewise the MSB of BL
corresponds to the SW8.
• A lot of hardware is required to decode the port address absolutely. For
hardware design, instead of decoding the address completely, only a part
of it may be decoded.
Input-Output Interfacing
Problem : Design an interface of an input port 74LS245 to read the status of switches SW1 to
SW8 and an output port 74LS373 with 8086. Display the number a key that is pressed, i.e. from 1
to 8 on a 7 Segment display with help of the output port write an ALP for this task assume that
only one key is pressed at a time. Draw the schematic of the required hardware. The input port
address 0008H and the output port address is 000AH.
13
25-02-2024
Input-Output Interfacing
Write an ALP for this task assume that only one key is pressed at a time. The
input port address 0008H and the output port address is 000AH.
MOV BL, 00H ; Clear BL for Switch status
MOV CL, 00H ; Clear CL for Switch Number
XOR AX, AX ; Clear accumulator and Flag
IN AL, 08H ; Read Switch Status
INC CL ; Increment CL for first Switch
YY: ROR AL, 01h ; Rotate switch status
JC XX ; If carry, jump to label XX
INC CL ; Else increment CL for next switch
JMP YY ; Number till carry is 1
XX: MOV AL,CL ; Take switch number into AL
OUT 0AH, AL ; Out BCD switch number for Display
HLT ; STOP
Input-Output Interfacing
Problem: Using 74LS373 output ports and 7-segment displays, design a
seconds counter that counts from 0 to 9. Draw the suitable hardware
schematic and write an ALP fro this problem. Assume that a delay of 1
sec is available as a subroutine. Select the port address suitably.
14
25-02-2024
Input-Output Interfacing
Problem: Draw a schematic hardware circuit for interfacing five, 7-segment
displays with 8086 using output ports. Display numbers 1 to 5 on them
continuously (common cathode) with 8086 using output ports. The 7
segment codes are stored in a look-up table serially at the address
2000:0000H onwards starting from code for 1.
Input-Output Interfacing
15
25-02-2024
Input-Output Interfacing
MOV AX, 2000H ;
MOV DS, AX ;
MOV BX, 0000H; Initialize code table with
DS:BX
Next: MOV AL, 00H; Get first number from the
table
MOV DH, AL
MOV CL, 05H; Count for the display
MOV DL, 01H; Selection code for first display
AGAIN: XLAT; translate the code
OUT 04H, AL;
ROL DL, 01H;
Input-Output Interfacing
Problem: Interface an input port 74LS245 to read the status of the
switches SW1 to SW8. The switches when shorted input a '1' else input a
'0' to the 8086 microprocessor. The store the status in register BL. The
address of the port is 0740H.
16
25-02-2024
Input-Output Interfacing
Problem 5: Interface an input port 74LS245 to read the status of the
switches SW1 to SW8. The switches when shorted input a '1' else input a
'0' to the 8086 microprocessor. The store the status in register BL. The
address of the port is 0740H.
17
25-02-2024
18
25-02-2024
19
25-02-2024
Example: A CPU wants to transfer data to a printer. In this case since speed of processor is very fast as
compared to relatively slow printer, so before actual data transfer it will send handshake signals to the
printer for synchronization of the speed of the CPU and the peripherals.
20
25-02-2024
21
25-02-2024
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 1 0
22
25-02-2024
23
25-02-2024
24
25-02-2024
25
25-02-2024
26
25-02-2024
27