Chapter 7-L
Chapter 7-L
ROM is also part of memory and a number of RAM and ROM chips
together constitute the total memory i.e., the total address space.
Typical RAM with control pins
Why Active Low Control Signals?
The stray capacitances of the control pins can get charged from noise
voltages, and this may cause the signals to cross the threshold of ‘high’
level as defined for TTL
– thus if the control signals are active high, it may cause wrong triggering.
On the other hand, an active low signal trigger will happen only when
the line is pulled low deliberately by the controller.
Example
How many address and data lines are needed for the memory chips with
the following organization?
i) 256 × 4
ii) 512 × 8
iii) 1K × 16
iv) 32 K × 8
v) 128 K × 8
vi) 1M × 32
Memory Address Decoding
i) Find out the range of addresses that the memory chip of 2K × 8 in Fig.1
ii) Repeat the same when the logic of the NAND gate is changed as in
Fig.2
Fig.2
Fig.1
Solution.
When more chips are to be interfaced, decode the extra address lines to a
different range for each group.
– Decoders (e.g. 2 × 4, 3 × 8 …)
solution
So, the total memory range from 00000H to 07FFFH is 32768 addresses (or 32 KB).
Solution – contd’
Example
Find the address space of the following chips with the address decoding
circuitry as shown in the Fig a and b.
i) 8 K x 8 EPROM
ii) 8 K x 8 RAM
Example -solution
Address Decoding Using Block Decoders
A very popular decoder is the 3 to 8 decoder (74LS138).
The output lines are active low and depending on the selection inputs, one
output line alone will be active.
Functional block diagram of the 3 to 8 decoder 74LS138
Decoding table of 74LS138
Address decoding of a RAM using a block decoder
Example
The figure shows a RAM and a ROM connected to an address decoder,
which is a 3 to 8 decoder. Find the address space of each of these chips.
Solution
Only 4 lines of the address bus are to be used for address decoding, as the
remaining 16 lines are to be connected to each of the 64 K memory chips.
For the ROM, A19 to A16 are to be 1001 (A19 = 1, CBA = 001).
Thus, the address range of this chip is 90000H to 9FFFFH.
Similarly, for the RAM, A19 to A16 are to be 1100 (A`9 = 1, CBA = 100). Th
us, the address range of this chip is C0000H to CFFFFH.
Partial Address Decoding
We find that in all our discussions so far, the addresses generated are
unique and create no ambiguity. This is also called exhaustive decoding.
However, sometimes to reduce the hardware used, only some of the upper
address lines are used for decoding and this is called partial address
decoding.
One, the upper bank or high bank with the data corresponding to the
upper byte D8–D15, the other, the lower bank or low bank which has the
data lines D0–D7.
The upper bank is also called the odd memory bank, because it has the
odd addresses mapped to it
If the address is odd ,the active low BHE signal will be activates
Even though our processor has 20 bits for address, I/O uses only 16 bits.
Thus I/O port addresses can range from 0000 to FFFFH and the total I/O
space is only 64 K i.e., we can use 65,536 different I/O addresses.
However, since the instructions for input (IN) and output (OUT) are
separate, we can have 64 K input ports and 64 K output ports.
Schemes of port addressing
Input Ports
Input ports use the IN instruction to receive data into the processor in the
accumulator of the processor (AL or AX).
To read from the input device, the IORD signal must be active (low).
When the above two conditions are true, the corresponding tri-state
buffer gets enabled and data is transferred to the processor.
ii) The address of the ports are 8-bit, as only address lines A0 to A7 have
been considered for decoding. The address of the first port is 7EH and
that of the second is 3EH.
iii) The address on the address bus decides which of the input ports get
selected. The tri-state buffer ensures that the port which is not selected, is
isolated from the bus.
Example –solution –contd’
iv) The program for inputting data from each of these ports is
STRT: IN AL, 3EH
MOV BL, AL
IN AL, 7EH
MOV DL, AL
Thus, after reading both ports, the switch settings are available in BL and
DL. This data can be used for processing and/or display.
Output Ports
Output ports use the instruction ‘OUT’ for writing into it.
Data from the processor is sent to an output port during the I/O write
cycle.
This data will be available on the data bus only until the end of a machine
cycle.
For the output port to be able to use this data, it must be latched.
Thus, a latch is mandatory for an output port set up.
Requirements of an Output Port