Chapter 2 - Parallel Interfacing With Microprocessor Based System
Chapter 2 - Parallel Interfacing With Microprocessor Based System
Chapter – 2
Parallel Interfacing with Microprocessor Based System
The device which can handle data at higher speed cannot support with serial interface. N bits of
data are handled simultaneously by the bus and the links to the device directly. Achieves faster
communication but becomes expensive due to need of multiple wires.
2.1 Methods of Parallel Data Transfer: Simple Input and Output, Strobe I/O, Single
Handshake I/O, & Double Handshake I/O
Parallel transmission of data is used for short distance where the speed of information transfer is
critical. This form of data communication is found in newer type of computer peripheral
equipment with transfer speed of to one million characters per second. The equipment includes
printers, disk drives and various other forms of peripheral components.
The information exchanged between a microprocessor and an I/O interface circuit consists of
input or output data and control information. The status information enable the microprocessor
monitor the device and when it is ready then send or receive data. Control information is the
command by microprocessor to cause I/O device to take some action. If the device operates at
different speeds, then microprocessor can be used to select a particular speed of operation of the
device. The techniques used to transfer data between different speed devices and computer is
called synchronizing. There are various ways of synchronization techniques which are involved
in parallel data transfer such as simple input and output, simple strobe I/O, single handshaking
and double handshaking.
Simple I/O
To get digital data from a simple switch into a microprocessor; switch is connected on input port
line from which port can be read. The data is always present and ready so that it can be read at
any time. Similarly to output data to a simple display device like LED, the input of LED buffer
is connected on an output port pin. And output the logic level required turning on the light. The
LED is always there and ready so that data can be sent at any time.
This timing waveform illustrates the simple I/O where cross lines represent the time at which a
new data byte becomes valid on the output lines of the port. Absences of other waveforms
indicate that this output operation is not directly dependent on any other signals.
Simple Strobe I/O
In many applications, valid data is present on an external device only at a certain time and must
be read in at that time. Here a strobe pulse is supplied to indicate the time at which data is being
transmitted. For an example, we can discuss the ASCII encoded keyboard. When a key is
pressed, circuitry on keyboard sends out ASCII code for pressed key on eight parallel data lines
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 1
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
and then sends out a strobe signal on another line to indicate that valid data is present on eight
data lines
The sending device outputs parallel data on the data lines, and then outputs STB’ signal to
represent the valid data is present.
In this technique, microprocessors need to wait until the device is ready for the operation and
also known as simple wait I/O. Consider a simple keyboard consisting of 8 switches connected to
a microprocessor through a parallel interface circuit (Tri-state buffer). The switch is of dip
switches. In order to use this keyboard as an input device the microprocessor should be able to
detect that a key has been activated. This can be done by observing that all the bits are in
required order. The processor should repeatedly read the state of input port until it finds the right
order of bits i.e. at least 1 bit of 8 bits should be 0.
Used to convert analog to digital data which can be read by I/O unit of microprocessor.
When SOC appears 1, I/O unit should ready for reading binary data/digital data.
When EOC’s status is 1, then I/O unit should stop to read data.
Strobe signal indicates the time at which data is being activated to transmit.
Single Handshaking
Handshaking is the method of synchronizing the actions of slow peripheral devices with that of
high speed microprocessor. It can have two transfer schemes.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 2
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
The peripheral outputs some data and send signal to microprocessor to tell “Here is
the data for you”.
Microprocessor detects asserted signal, reads the data and sends an acknowledge
signal (ACK) to indicate data has been read and peripheral can send next data, “I got that
one, send me another”.
Microprocessor sends or receives data when peripheral is ready.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 3
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
The peripheral asserts its line low to ask microprocessor “Are you ready?”
The microprocessor raises its ACK line high to say “I am ready”.
Peripheral then sends data and raises its line low to say “Here is some valid data for
you.”
Microprocessor then reads the data and drops its ACK line to say, “I have the data, thank
you, and I await your request to send the next byte of data.”
2.2 8255 as General Purpose Programmable I/O Device and its interfacing examples
The Intel 8255 A is a general purpose programmable I/O device designed for use with Intel
microprocessors. It has 24 I/O pins that can be grouped primarily in two 8-bit parallel ports: A
and B, with the remaining bits as port C. The 8-bits of port C can be used as individual bits or be
grouped in two 4-bits ports: C upper (Cu) and C lower (Cl). The functions of these ports are
defined by writing a control word in the control register.
Bit Set/Reset mode: The BSR mode is used to set or reset the bits in port C.
I/O mode: The I/O mode is further divided into three modes: mode 0, mode 1 and mode
2. In mode 0, all ports function as simple I/O ports. Mode 1 is a handshake mode
whereby ports A and/or B use bits from port C as handshake signals. In the handshake
mode, two types of I/O data transfer can be implemented: status check and interrupt. In
mode 2, port A can be set up for bidirectional data transfer using handshake signals from
port C and port B can be set up either in mode 0 or mode 1.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 4
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
The pin diagram and block diagram of 8255 is given above. It has the following main blocks.
The 3-state bidirectional 8-bit buffer is used to interface the 8255A to the system data bus.
Data is transmitted or received by the buffer upon execution of input or output instructions
by the CPU. Control words and status information are also transferred through the data bus
buffer.
The function of the block is to manage all of the internal and external transfers of both data
and control or status words. It accepts inputs from the CPU address and control buses and in
turn, issues commands to both of the control groups.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 5
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Chip Select (CS’): A “low” on this pin enables the communications between the
8255A and the CPU.
Read (RD’): A “low” on this input enables the 8255A to send the data or status
information to the CPU on the data bus. In essence, it allows the CPU to read from
the 8255A.
Write (WR’): A “low” on this input pin enables the CPU to write data or control
words into the 8255A.
Reset (RESET): A “high” to this pin clears the control register and sets all ports (A, B
and C) in the input mode.
A0 and A1: These input signals controls the selection of one of the three ports or the
control word register. They are connected to the least significant bits of the address
bus.
The CS’ signal is the master chip select, and A0 and A1 specify one of the I/O ports or the
control register as given below.
CS’ A1 A0 Selected
0 0 0 Port A
0 0 1 Port B
0 1 0 Port C
0 1 1 Control Register
1 X X 8255A is not
selected
Functional configuration of each port is programmed by the system software. In essence, the
CPU outputs a control word to the 8255A. The control word contains information such as
“mode”, “bit set’, “bit reset”, etc. that initialize the functional configuration of the 8255A.
Each of the control blocks (Group A and Group B) accepts “commands” from the
Read/Write control logic, receives control word from the internal data bus and issues the
proper commands to its associated ports.
Control Word
When A0 and A1 pins have value 1, the mapped address addresses the control register which is
the 8-bit register to write the specific content according to the port conditions although it cannot
be read. The content of this register is called control word which specifies an I/O function for
each port.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 6
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
The MSB (D7) of the control word tells which control word we are sending it that is it specifies
either the I/O function or the Bit Set/Reset function. If bit D7=1, bits D6-D0 determine I/O
functions in various modes as shown in figure. If bit D7=0, port C operates in the Bit Set/Reset
(BSR) mode. The BSR control word does not affect the functions of ports A and B.
To communicate with peripherals through 8255, following are the steps are necessary.
Determine the Port addresses of Ports A, B and C and of the control register according to
Chip Select logic and address lines A1 and A0.
Write a control word in control register.
Write I/O instructions to communicate with peripherals through Ports A, B and C.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 7
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Q. Determine the Control word for the following configuration of ports of Intel 8255A
PPI chip.
a. Port A output, mode of port A mode 1, port B output, mode of port B mode 0, port C lower
pins as output and remaining pins of port C upper as output.
D7 D6 D5 D4 D3 D2 D1 D0 = A0H
1 0 1 0 0 0 0 0
b. Port A output, mode 0, port B output, mode 0, port C lower output and port C upper input.
D7 D6 D5 D4 D3 D2 D1 D0 = 88H
1 0 0 0 1 0 0 0
c. Port A input, mode 1, port B output, mode 1, and remaining pins of port C upper input.
d. Port A input mode 1, port B output mode 0, port C lower input and port C upper output.
D7 D6 D5 D4 D3 D2 D1 D0 = B1H
1 0 1 1 0 0 0 1
e. Port A bidirectional (Mode 2), port B input mode 0, port C lower output.
Operating Modes
This functional configuration provides simple input and output operation for each of the three
ports. No ‘handshaking” is required; data is simply written to or read from a specified port.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 8
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
BSR mode is concerned only with eight bits of port C, which can be set or reset by writing an
appropriate control word in the control register. A control word with bit D7=0 is recognized as a
control word and it does not alter any previously transmitted control word with bit D7=1; thus the
I/O operations of ports A and B are not affected by a BSR control word. In the BSR mode
individual bits of port C can be used for applications such as On/Off switch.
BSR Control Word: This control word, when written in control register, sets or resets one
bit at a time, as specified in figure.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 9
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Q. Determine the BSR Control word for the following Port C configurations.
a. Set PC7
To set PC7
b. Reset PC3
The functional configuration provides a means for transferring I/O data to or from a specified
port in conjunction with strobes or handshaking signals. In mode 1, port A and port B use the
lines of port C to generate or accept these handshaking signals.
The functional configuration provides a means for communicating with a peripheral device or a
structure on a single 8-bit bus for both transmitting and receiving data (bidirectional bus I/O).
“Handshaking Signals” are provided to maintain proper bus flow discipline in a similar manner
to Mode 1. Interrupt generation and enable/disable functions are also available.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 10
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
The 5-bit control port (Port C) is used for control and status for the 8-bit,
bidirectional bus port (Port A)
A high on the RESET pin causes all 24 lines of the three 8-bit ports to be in the input mode. All
flip-flops are cleared and the interrupts are reset. This condition is maintained even after the
RESET goes low. The ports of the 8255 can then be programmed for any other mode by sending
out a single output instruction to the control register. Also, the current mode of operation can be
changed by writing a single mode word onto the control register, when required.
Modes for Group A and Group B can be separately defined with Port C taking on responsibilities
as dictated by the mode definitions or Ports A and B. If Group A is programmed for Mode 0, and
Group B is programmed for Mode 1, Port A and PC4–PC7 can be programmed for either input or
output, while Port B can be programmed for input or output with PC0–PC2 used for handshaking.
The mode definition format and bit set-reset format are discussed in above topics. The control
words for both mode definition and Bit Set-Reset are loaded into the same control register, with
bit D7 used for specifying whether the word loaded into the control register is a mode definition
word or Bit Set-Reset word. If D7 is high, the word is taken as a mode definition word, and if it is
low, it is taken as a Bit Set-Reset word. The appropriate bits are set of reset depending on the
type of operation desired, and loaded into the control register (which is accessed when A1 and A0
both are '1'; WR and CS both are '0'. It is to be noted that Group B does not have provision for
operation in Mode 2.
The eight possible combinations of the states of bits D1 -D3 (B2 B1 B0) in the Bit Set-Reset
format (henceforth referred to as BSR) determine the particular bit in PC0-PC7 being set or reset
as per the status of bit D0. A BSR word is to be written for each bit that is to be set or reset. For
example, if bit PC2 is to be set and bit PC7 is to be reset, the appropriate BSR words that will
have to be loaded into the control register will be, 0XXX001 and 0XXX1110, respectively,
where X can be either '0' or '1'.
The BSR, word can also be used for enabling or disabling interrupt signals generated by Port C
when the 8255 is programmed for Mode 1 or Mode 2 operation. This is done by setting or
resetting the associated bits of the interrupts.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 11
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Example 1
a) Identify the port addresses in given figure.
b) Identify the Mode 0 control word to configure port A as an input port and port B as an
output port.
c) Write a program to read the Dip switches and display the reading from port A at port B.
Solution
a) This is I/O mapped I/O; when A15 A14 A13 is 011, then chip select of 8255 is enabled. We
also know that during the execution of IN and OUT instruction, A15-A8 and AD7-AD0 carry
the same signals. Keeping this in mind, port addresses will be derived. Firstly, port A’s port
address will be calculated as under:
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
0 1 1 X X X X X = X X X X X X 0 0
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. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 12
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
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 = 90H
1 0 0 1 X 0 0 X
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
Example 2
Write a BSR control word to set PC7, PC6, PC5, PC4, PC3, PC2, PC1, and PC0 and reset each after
1 second.
Solution
Let us assume Port addresses same as example 1. The control word is calculated with Port C
output in this case so it is 10000 0000 (80H). BSR control word for each case is given as under:
Program Subroutine
MVI A, 80H
LOOP: OUT 63H
MVI A, 0FH
OUT 63H
CALL DELAY
DCR A
ANI 0FH
JMP LOOP
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 14
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
LOOP2: DCR E
JNZ LOOP2
DCR D
JNZ LOOP1
DCR C
JNZ LOOP
RET
Mode 1 Input
Below figure shows Port A as input port (when it operates in Mode 1) along with the control
word and control signals (for handshaking with a peripheral). When the control word is loaded
into control register, Group A is configured in Mode 1 with Port A as an input port, Port A can
accept parallel data from a peripheral (like a keyboard) and this data can be read by the CPU.
The peripheral first loads data into Port A by making the STBA input low. This latches the data
placed by the peripheral on the common data bus into Port A. Port A acknowledges reception of
data by making IBFA (Input Buffer Full) high. IBFA is set when the STBA input is made low.
INTRA is an active output signal which can be used to interrupt the CPU so that the CPU can
suspend its current operation and read the data written into Port A by the peripheral. INTR A can
be enabled or disabled by the INTEA flip-flop which is controlled by BIT Set-Reset operation of
PC4. INTRA is set (if enabled by setting the INTEA flip-flop) after the STBA has gone high again,
and if IBFA is high.
On receipt of the interrupt, the CPU can be made to read Port A. The falling edge of the RD input
resets IBFA and it goes low. This can be used to indicate to the peripheral that the input buffer is
empty and that data can again be loaded into it.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 15
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 16
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Fig: Timing Waveforms for Strobed Input (With Handshake) – 8255 Mode 1
Above figure shows Port B as an input port (when in Mode 1). The timing diagram and operation
of Port B is similar to that of Port A except that it uses different bits of Port C for control. INTEB
is controlled by Bit Set/Reset of PC2.
If the CPU is busy with other system operations, it can read data from the input port when it is
interrupted. This is often called Interrupt Controlled I/O. However, if the CPU is otherwise not
busy with other jobs, it can continuously poll (read) the status word to check for an IBF A. This is
often called Program Controlled I/O. The status word is accessed by reading Port C (A1 A0 must
be 10, RD and CS must be low). The status word format as assumed by the bits of Port C when
Ports A and B are input ports in Mode 1, is shown in above figure.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 17
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Mode 1 Output
Figure below shows Port A configured as an output port (when in Mode 1) along with the control
word and control signals (for handshaking with a peripheral). When the control word is loaded
into the control register, Group A is configured in Mode 1 with Port A as an output port. The
CPU can send out data to a peripheral (like a display device) through Port A of the 8255.
The OBFA output (Output Buffer Full) goes low on the rising edge of the WR signal (when the
CPU writes data into the 8255). The OBFA output from 8255 can be used as a strobe input to the
peripheral to latch the contents of Port A. The peripheral responds to the receipt of data by
making the ACKA input of the 8255 low, thus acknowledging that it has received the data sent out
by the CPU through Port A. The ACKA low resets the OBFA signal, which can be polled by the
CPU through OBFA of the status word to load the next data when it is high again.
INTRA is an active high output of the 8255 which is made high (if the associated INTE flip-flop
is set) when ACKA is made high again by the peripheral, and when OBFA goes high again (see
timing diagram in Figure below). It can be used to interrupt the CPU whenever the output buffer
is empty. It is reset by the falling edge of WR when the CPU writes data onto Port A. It can be
enabled or disabled by writing a '1' or a '0' respectively to PC6 in the BSR mode.
Figure below shows Port B as an output port when in Mode 1. The operation of Port B is similar
to that of Port A. INTEB is controlled by writing a '1' or '0' to PC2 in the BSR mode.
The status word is accessed by issuing a Read to Port C. The format of the status word as
assumed by the bits of Port C when Ports A and B are Output ports in Mode 1 is shown in Figure
below.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 18
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 19
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Fig: Timing Waveform for Strobed (With Handshake) Output - 8255 Mode 1
Example 3
Below mentioned figure shows an interfacing circuit using the 8255A in Mode 1. Port A is
designated as the input port for a keyboard with interrupt I/O and port B is designated as the
output port for a printer with status check I/O.
a) Find port addresses by analyzing the decode logic.
b) Determine the control word to set up port A as input and port B as output in Mode 1.
c) Determine the BSR word to enable INTEA.
d) Determine the masking byte to verify the OBF’ line in status check I/O.
e) Write subroutine to accept character from keyboard and send character to printer.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 20
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Solution
a) The 8255A is connected as I/O mapped I/O. When the address lines A7-A2 are all 1, the
output of NAND gate goes low and selects 8255A. The port addresses are calculated as
1111 11XX:
Port A = 1111 1100 (FCH)
Port B = 1111 1101 (FDH)
Port C = 1111 1110 (FEH)
Control Register = 1111 1111 (FFH)
b) Control word to set up port A as input and port B as output Mode 1 is:
D7 D6 D5 D4 D3 D2 D1 D0 = B4H
1 0 1 1 X 1 0 X
c) BSR word to set INTEA
D7 D6 D5 D4 D3 D2 D1 D0 = 09H
0 0 0 0 1 0 0 1
d) Status word to check OBFB’
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 21
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 22
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 23
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Assignment 1:
Interfacing keyboard and seven segment display
Interfacing a microprocessor to a tape reader and lathe
Interfacing to parallel printer
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 24
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 25
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 26
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Fig: The 16-bit ISA bus. (a) Both 8- and 16-bit connectors and (b) the pinout of the 16-bit
connector.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 27
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 28
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 29
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Tutorials:
1. Assume that your group has decided to make a PC based control system for a wine company.
After studying the system, your group found out that the following to be implemented for
controlling purpose:
Pressure measurement (6 points)
Temperature measurement (5 points)
Weight measurement (1 point)
Volume measurement for filling (5 points)
Your group also decided to use 8255A PPI card at base address 0550H.
a) List out collected documents and components
b) List out different signals you need to derive and or can be directly connected to your
interfacing circuit.
c) Draw minimum mapping circuit for above system
d) What are the address captured by card
e) Generate necessary control word
f) Write a program module for measuring the pressure of all the points and control if the
pressure is not in a range, Assume suitable data if necessary.
Solution:
a) Components: 8255A card, ADC, MUX, Memory, Processor, connecting wires, power
supplies (+5V, GND), gates etc.
Documents: Data sheets and technical documentation of above components
b) Signals needed to be derived on directly connected to circuit
A1, A2, Chip Select ( CS ) for Port selection of of 8255A, RESET signal
Read ( RD ) and Write ( WR ) signals
Start Conversion (SC) and End of Conversion (EOC)
c) The minimum mapping circuit is as given below:
D7 PA7 D7
To 8085 PA0 D0
D0 8 Bit Vin
A15 ADC
. PC7 EOC
. CS PC0 SC
.
A2 8255A
A1 PPI
A0
Select Line
RD PB4 32X1
WR PB0 MUX
……
RESET OUT Analog
Input
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 30
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
d) The base address of card is 0550H, following are address captured by card.
Port Address A A A A A A A A A A A A A A A A
1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0
5 4 3 2 1 0
A 0550H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0
B 0551H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 1
C 0552H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 0
CR 0553H 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1
The total numbers of monitoring points are 17. If we use 1 ADC for all of them, we need
to select any one at given time. So, we can use 32X1 MUX which would then have 25=32
i.e. 5 selection lines (B0 to B4). These lines can have defined for any of the 17 lines.
In the above circuit,
Port A Input port to read data from ADC in mode 0
Port B Output port to select any one of 17 lines from MUX in mode 0
Port C Output port (PC0 as SC) and Input port (PC7 as EOC)
D7 D6 D5 D4 D3 D2 D1 D0 = 98H
1 0 0 1 1 0 0 0
D7 D6 D5 D4 D3 D2 D1 D0 = 01H
0 0 0 0 0 0 0 1
D7 D6 D5 D4 D3 D2 D1 D0 = 00H
0 0 0 0 0 0 0 0
Assuming that ADC starts the conversion process only when it receives SC signal and
after conversion indicates via EOC line i.e. it has finished conversion and so ADC port
data in its data lines which can be now be read through port A.
f) Program Module:
LXI H, MEMORY
MVI A, 98H
STA 0553H; write control word in CR
MVI C, 06H; set counter to read 6 pressure points
MVI B, 00H; selection of points for MUX
NEXT: MOV A, B
STA 0551H; select first pressure point
MVI A, 01H; load A with BSR word to set PC0
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 31
Instrumentation II Chapter 2 : Parallel Interfacing With Microprocessor Based System
Load temperature from temperature sensor LM135 and control fan and heater.
If temperature > 35o Fan ON
If temperature < 10o Heater ON
(Refer Gaonkar 15.1.4 pages 468-472)
6. You are required to monitor the operation of pump as well as status of upper and lower tank
in the household. Apart from that you need to control 3 lights that are to turn ON in the
evening and turn OFF in the morning time. Additionally, you also need to check the status of
smoke sensors in Room1, Room2 & Room3, and heat sensor in kitchen and ring alarm when
necessary.
Your group also decided to use 8255 PPI card at base address 3000H in memory mapped I/O
for controlling purpose. Make complete circuitry including relays and relay driving
transistor.
Write a program module to read status of heat sensor and generate alarm when the limit
exceeds.
Compiled By: Er. Hari Aryal [haryal4@gmail.com] References: Gaonkar, Hall & Brey | 32