Compiled By:-Er. Praveen Kumar Karn Lalitpur Engineering College
Compiled By:-Er. Praveen Kumar Karn Lalitpur Engineering College
To have equality, 0’s and 1’s on one side of the equation must appear on
other sides. This means that AD7 AD6 AD5 must equal 011 and A9 and A8
must equal 00 (port A) to get
0 1 1 X X X 00 = 0 1 1 X X X 00
Since the remaining don’t cares can be 0’s and 1’s, there are many solutions.
For instance, if all the don’t cares are equal to zero; address of port A
becomes 1110 0000 (60H). The port addresses of the given figure are
determined as under:
Port A = 60H
Compiled by :- Er. Praveen Kumar Karn Lalitpur Engineering College
Port B = 61H
Port C = 62H
Control Register = 63H
b) The Mode 0 control word to configure port A input and port B
output is calculated as under:
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 1 X 0 0 X
=90H
c) Program subroutine to read DIP switches and display the reading
from port A at port B is as under:
MVI A, 90H; Load ACC with the control word
OUT 63H; Write the control word in control register and initialize
the ports
IN 60H; Reads switches at port A
OUT 61H; Display the reading at port B
RET
Compiled by :- Er. Praveen Kumar Karn Lalitpur Engineering College
II. Memory mapped I/O
Write a program to read the DIP switches and display the reading
from port B at port A and from port C (lower) to port C(upper).
(Gaonkar, 2010) .
1.Port Addresses :- This is memory mapped I/O ; when the
address line A15 is high, the chip select line is enabled. Assuming
all don’t care lines are at logic 0,the port addresses are as follows
Port A =8000H(A1=0,A0=0)
Port B =8001H(A1=0,A0=1)
Port C=8002H(A1=1,A0=0)
Control Register=8003H(A1=1,A0=1)