PadhaikoAll subjects

Parallel Interface, Handshaking & the PPI

Microprocessors (ENEX 201)

Open in the Padhaiko app

4.3 Parallel Interface

In parallel data communication, all bits of a data byte (or word) are transmitted simultaneously across multiple parallel conductors (data lines), referenced to a common electrical ground and synchronized by control strobes.

Because multiple data bits travel concurrently, parallel interfaces provide high data transfer bandwidth over short physical distances (typically less than 3 meters). Over longer cables, parallel communication suffers from cable capacitance, signal skew (where bits arrive at slightly different times due to minor differences in wire length or impedance), and inter-wire electromagnetic crosstalk.

Parallel I/O Hardware Requirements

To interface an 8-bit parallel peripheral with the microprocessor system bus, two hardware components are mandatory:

  1. Latching for Output Ports: The microprocessor places data on the data bus for only a fraction of a microsecond during the write machine cycle (specifically during clock states T2 and T3). A peripheral device (such as an LED array, digital-to-analog converter, or motor controller) requires the data to remain stable continuously. Therefore, an output port must incorporate an 8-bit latch (e.g., 74LS374 or 74LS373) that captures data on the rising or falling edge of the write strobe and maintains its output state indefinitely.
  2. Tri-State Buffering for Input Ports: The microprocessor data bus is shared among multiple memory chips and input devices. If an input device drove the data bus continuously, it would cause severe bus contention and short-circuits. Therefore, an input port must incorporate an 8-bit tri-state buffer (e.g., 74LS244) whose outputs remain in a high-impedance (floating) state until an active-low device select signal enables them onto the bus during an input machine cycle.

4.3.1 Modes: Simple, wait, single handshaking and double handshaking

Depending on the operational speed, synchronization method, and intelligence of the peripheral device, parallel data transfer between the CPU and an external device is performed using four distinct operational modes.

1. Simple I/O (Unconditional / Basic I/O)

Simple I/O is used when the peripheral device is always ready to receive or supply data, requiring no status inquiry or hardware synchronization.

2. Wait State I/O (Hardware Synchronization via READY Pin)

When a peripheral device or memory chip has an access time slower than the standard bus cycle of the microprocessor, the CPU must be temporarily suspended.

3. Single Handshaking I/O (Strobed Handshake)

In single handshaking (also called strobed I/O), transfer is coordinated using dedicated control signals (a strobe pulse and a status flag) between the sender and receiver.

4. Double Handshaking I/O (Fully Interlocked Handshake)

Double handshaking eliminates all timing dependencies by implementing a four-phase closed-loop protocol where every transition by the sender requires an explicit confirmation transition from the receiver before proceeding.

Definition

Four-Phase Interlocked Double Handshaking Protocol

The sender uses a Data Available (DAV) or Request line, and the receiver uses a Data Accepted (DAC) or Acknowledge line. Neither device ever transitions to the next state until the opposite device confirms the previous transition:

  1. Phase 1 (Sender Request): The sender places valid data on the parallel data lines and, after allowing for signal settling time, asserts DAV = HIGH.
  2. Phase 2 (Receiver Acknowledge): The receiver senses DAV = HIGH, reads the data lines into its internal buffer, and asserts DAC = HIGH to confirm reception.
  3. Phase 3 (Sender De-assertion): The sender detects DAC = HIGH, acknowledges that the receiver has safely captured the data, floats or changes the data bus, and de-asserts DAV = LOW.
  4. Phase 4 (Receiver Reset): The receiver detects that DAV has returned to LOW and de-asserts DAC = LOW. Both lines are now in the idle state, ready for the next transfer.
Comparison of Parallel I/O Transfer Modes
ModeControl LinesSynchronization MechanismTransfer SpeedHardware ComplexityTypical Peripheral
Simple I/ONoneUnconditional; assumes device always readyMaximum bus rateLowest (buffer or latch only)DIP switches, LED status bar
Wait State I/O1 (READY line)CPU enters idle clock cycles (Tw)Slower; throttled to device speedMinimal (delay generator / counter)Slow EPROM, ADC conversion cycle
Single Handshaking2 (Strobe + Buffer Full / Ack)Pulse-based strobe and status flagMedium; coordinated per byteModerate (status latch + flip-flops)Dot-matrix printer (Centronics interface)
Double Handshaking2 (DAV + DAC lines)Fully interlocked 4-phase closed loopVariable; asynchronous and robustHigher (state machine / protocol logic)Inter-processor parallel bus, IEEE-488 GPIB

4.3.2 Introduction to programmable peripheral interface (PPI)

The Intel 8255A is a 40-pin, monolithic Programmable Peripheral Interface (PPI) chip designed to provide multi-functional parallel I/O between the microprocessor and external devices without requiring custom hardware redesign.

Text
                    +--------------------+
         D7–D0 <===>| Data Bus Buffer    |
                    | (Bidirectional)    |
                    +--------------------+
                              ||
                    +--------------------+    +--------------------+
       CS_bar ----->| Read / Write       |===>| Group A Control    |---> Port A (PA7–PA0)
       RD_bar ----->| Control Logic      |    |                    |---> Port C Upper (PC7–PC4)
       WR_bar ----->|                    |    +--------------------+
       A1, A0 ----->|                    |
        RESET ----->|                    |    +--------------------+
                    +--------------------+===>| Group B Control    |---> Port B (PB7–PB0)
                                              |                    |---> Port C Lower (PC3–PC0)
                                              +--------------------+
                                      Intel 8255A PPI

Internal Functional Architecture

The 8255A consists of four primary internal functional sections:

  1. Data Bus Buffer: A tri-state, bidirectional 8-bit buffer that interfaces the internal 8255A buses to the system data bus (D7–D0). It transmits data bytes, control words, and status information.
  2. Read/Write and Control Logic: Manages all internal and external data transfers in response to CPU control signals:
    • CS_bar (Chip Select, pin 6): Active LOW. Enables communication between CPU and 8255A.
    • RD_bar (Read, pin 5): Active LOW. Enables 8255A to send data or status onto data bus D7–D0.
    • WR_bar (Write, pin 36): Active LOW. Enables CPU to write data or control words into 8255A.
    • A1, A0 (Port Address Inputs, pins 9 and 8): Selects internal ports and registers.
    • RESET (Reset, pin 35): Active HIGH. Clears the control register and sets all 24 port pins to Mode 0 input mode as a safety measure.
  3. Group A and Group B Controls:
    • Group A Control: Configures Port A (8 pins) and Port C Upper (4 pins, PC7–PC4).
    • Group B Control: Configures Port B (8 pins) and Port C Lower (4 pins, PC3–PC0).
  4. Three 8-Bit Ports (24 I/O Pins):
    • Port A (PA7–PA0): One 8-bit data output latch/buffer and one 8-bit data input latch. Can operate in Mode 0, Mode 1, or Mode 2.
    • Port B (PB7–PB0): One 8-bit data input/output latch/buffer and one 8-bit input buffer. Can operate in Mode 0 or Mode 1.
    • Port C (PC7–PC0): One 8-bit data output latch/buffer and one 8-bit input buffer (unlatched input). It can be divided into two 4-bit ports (PC Upper and PC Lower) for simple I/O, or used to provide handshaking control signals for Port A and Port B.
8255A Internal Register Selection via A1 and A0
CS_barA1A0RD_barWR_barSelected Internal Operation
00001Read Port A data onto D7–D0
00101Read Port B data onto D7–D0
01001Read Port C data onto D7–D0
00010Write D7–D0 data into Port A latch
00110Write D7–D0 data into Port B latch
01010Write D7–D0 data into Port C latch
01110Write Control Word into Control Register
01101Illegal Condition (Control Register cannot be read directly)
1XXXX8255A Deselected (Data Bus D7–D0 in High-Impedance State)

Operating Modes of 8255A

The 8255A operates in two primary modes selected by the most significant bit (D7) of the written control byte:

  1. Bit Set/Reset (BSR) Mode (D7 = 0)
  2. Input/Output (I/O) Mode (D7 = 1)

1. Bit Set/Reset (BSR) Mode Format (D7 = 0)

BSR mode is used exclusively to set (to 1) or reset (to 0) any individual bit among the eight pins of Port C (PC7 through PC0) with a single OUT instruction, without disturbing any other pin of Port C.

Text
+----+----+----+----+----+----+----+----+
| D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
+----+----+----+----+----+----+----+----+
  |    \__________/   \_________/    |
  |     Don't Care     Bit Select    +---> 1 = SET bit
  |       (0 0 0)      (000 to 111)        0 = RESET bit
  +--------------------------------------> 0 = BSR Mode Select
BSR Mode Bit Selection Map
D3D2D1Selected Port C BitControl Word for SET (D0=1)Control Word for RESET (D0=0)
000PC00000 0001B (01H)0000 0000B (00H)
001PC10000 0011B (03H)0000 0010B (02H)
010PC20000 0101B (05H)0000 0100B (04H)
011PC30000 0111B (07H)0000 0110B (06H)
100PC40000 1001B (09H)0000 1000B (08H)
101PC50000 1011B (0BH)0000 1010B (0AH)
110PC60000 1101B (0DH)0000 1100B (0CH)
111PC70000 1111B (0FH)0000 1110B (0EH)

2. I/O Mode Control Word Format (D7 = 1)

When D7 = 1, the byte loaded into the Control Word Register defines the operational mode and direction of Ports A, B, and C.

Text
+----+----+----+----+----+----+----+----+
| D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
+----+----+----+----+----+----+----+----+
  |    \_____/   |    |    |    |    |
  |     Mode     |    |    |    |    +---> Port C Lower (PC3–PC0): 1=Input, 0=Output
  |    Port A    |    |    |    +--------> Port B Direction: 1=Input, 0=Output
  |              |    |    +-------------> Port B Mode: 0=Mode 0, 1=Mode 1
  |              |    +------------------> Port C Upper (PC7–PC4): 1=Input, 0=Output
  |              +-----------------------> Port A Direction: 1=Input, 0=Output
  |
  +--------------------------------------> 1 = I/O Mode Select

Summary of the Three I/O Modes

  1. Mode 0 (Basic / Simple Input/Output):
    • Provides three independent 8-bit ports (Port A, Port B, and Port C split as PC Upper and PC Lower).
    • Any port can be programmed as either an input or an output.
    • Outputs are latched; inputs are buffered but not latched.
    • No handshaking is involved; data transfer is simple and unconditional.
  2. Mode 1 (Strobed Handshake I/O):
    • Transmits or receives data across Port A and/or Port B in conjunction with handshaking control signals provided by Port C.
    • Both inputs and outputs are latched.
    • Supports interrupt-driven data transfer via an internal Interrupt Enable (INTE) flip-flop.
    • Handshaking allocation:
      • Port A Input: PC4 = STB_A_bar (Strobe Input), PC5 = IBF_A (Input Buffer Full), PC3 = INTR_A (Interrupt Request Output).
      • Port A Output: PC7 = OBF_A_bar (Output Buffer Full), PC6 = ACK_A_bar (Acknowledge Input), PC3 = INTR_A (Interrupt Request Output).
      • Port B Input: PC2 = STB_B_bar, PC1 = IBF_B, PC0 = INTR_B.
      • Port B Output: PC1 = OBF_B_bar, PC2 = ACK_B_bar, PC0 = INTR_B.
  3. Mode 2 (Strobed Bidirectional Bus I/O):
    • Configures Port A exclusively as an 8-bit bidirectional data bus.
    • Uses five pins of Port C (PC7 through PC3) for handshaking:
      • PC7 = OBF_A_bar (Output Buffer Full)
      • PC6 = ACK_A_bar (Acknowledge input for output data)
      • PC4 = STB_A_bar (Strobe input for incoming data)
      • PC5 = IBF_A (Input Buffer Full)
      • PC3 = INTR_A (Interrupt Request)
    • Port B can simultaneously operate in Mode 0 or Mode 1 using the remaining pins of Port C (PC2, PC1, PC0).

Worked Examples

Example

8255A Mode 0 Control Word Calculation and Switch-to-LED Program

An Intel 8255A PPI is interfaced to an 8085 system in I/O-mapped mode with base address 80H:

  1. Construct the 8-bit I/O Control Word in binary and hexadecimal.
  2. Write an 8085 assembly program to initialize the 8255A, read the switch pattern from Port A, and display it continuously on the LEDs connected to Port B. Show register states and timing.

Determine Control Word Bit Fields: The required configuration specifies:

  • D7 = 1 (I/O Mode active)
  • D6, D5 = 00 (Port A in Mode 0)
  • D4 = 1 (Port A = Input)
  • D3 = 1 (Port C Upper = Input)
  • D2 = 0 (Port B in Mode 0)
  • D1 = 0 (Port B = Output)
  • D0 = 0 (Port C Lower = Output)

Combining these bits from D7 down to D0: Control Word = 1 0 0 1 1 0 0 0 B = 98H

Port Address Mapping: The base address is 80H:

  • Port A address (A1=0, A0=0) = 80H
  • Port B address (A1=0, A0=1) = 81H
  • Port C address (A1=1, A0=0) = 82H
  • Control Word Register (A1=1, A0=1) = 83H

Assembly Language Program:

8085 ASM
ORG 2000H
MVI A,98H
OUT 83H
READ:
IN 80H
OUT 81H
JMP READ

Instruction Trace and Register States:

  1. MVI A,98H: Loads control word 98H into Accumulator.
After Control Word Load
A98H
B00H
C00H
D00H
E00H
H00H
L00H
S0
Z0
AC0
P0
CY0
MVI A,98H CLK A15–A8 AD7–AD0 ALE IO/M̅ S1 S0 RD̅ WR̅ OF T1 T2 T3 T4 20H Unspecified 00H 3EH High-Z MR T1 T2 T3 20H 01H 98H
MVI A,98H · OF + MR · 7 T-states
  1. OUT 83H: Writes 98H into Control Register (address 83H), configuring Port A as input and Port B as output. Cycles: OF (4T), MR (3T), IOW (3T) = 10 T-states.
  2. IN 80H: Reads DIP switch data (assume 3CH = 0011 1100B) into Accumulator.
After IN 80H
A3CH
B00H
C00H
D00H
E00H
H00H
L00H
S0
Z0
AC0
P0
CY0
IN 80H CLK A15–A8 AD7–AD0 ALE IO/M̅ S1 S0 RD̅ WR̅ OF T1 T2 T3 T4 20H Unspecified 04H DBH High-Z MR T1 T2 T3 20H 05H 80H IOR T1 T2 T3 80H 80H 3CH
IN 80H · OF + MR + IOR · 10 T-states
  1. OUT 81H: Writes 3CH from Accumulator to Port B LEDs.
Answer:

The control word is 98H (10011000B). The program writes 98H to Control Register 83H, then enters an infinite loop reading Port 80H and writing directly to Port 81H.

Example

Square Wave Generation on PC4 Using BSR Mode

An 8085 microprocessor system uses an Intel 8255A PPI whose control register is mapped at I/O address 03H.

Using the Bit Set/Reset (BSR) mode of the 8255A, write an 8085 assembly program to generate a continuous square wave on pin PC4. Determine the exact BSR control words required to set and reset PC4.

Formulate the BSR Control Words for PC4: In BSR mode:

  • D7 = 0 (BSR mode flag)
  • D6, D5, D4 = 0 0 0 (Don't care, conventionally set to 0)
  • D3, D2, D1 = Bit select code for PC4 = 1 0 0 (binary 4)
  • D0 = Bit state: 1 for SET, 0 for RESET

Therefore:

  • To SET PC4: 0 0 0 0 1 0 0 1 B = 09H
  • To RESET PC4: 0 0 0 0 1 0 0 0 B = 08H

Assembly Language Implementation:

8085 ASM
ORG 2100H
WAVE:
MVI A,09H
OUT 03H
CALL DELAY
MVI A,08H
OUT 03H
CALL DELAY
JMP WAVE

DELAY:
MVI B,10H
DLY_LOOP:
DCR B
JNZ DLY_LOOP
RET

Execution Trace:

  1. MVI A,09H followed by OUT 03H: Writes 09H into Control Register 03H. Internal logic sets pin PC4 HIGH (5V).
After Setting PC4
A09H
B00H
C00H
D00H
E00H
H00H
L00H
S0
Z0
AC0
P0
CY0
  1. CALL DELAY pauses execution for the HIGH duration of the square wave.
  2. MVI A,08H followed by OUT 03H: Writes 08H into Control Register 03H. Internal logic resets pin PC4 LOW (0V).
After Resetting PC4
A08H
B00H
C00H
D00H
E00H
H00H
L00H
S0
Z0
AC0
P0
CY0
  1. CALL DELAY pauses execution for the LOW duration. The JMP WAVE repeats the cycle indefinitely, producing a periodic square wave on pin PC4.
Answer:

Control word to SET PC4 = 09H; control word to RESET PC4 = 08H. The program alternates between writing 09H and 08H to Control Register 03H with intervening delay subroutines.

Example

Mode 1 Strobed Handshake Control Word Formulation

Configure the Intel 8255A PPI to operate with:

Determine the binary and hexadecimal I/O Control Word. Identify the functional handshake signals assigned to Port C pins.

Analyze Control Word Bit Assignments:

  • D7 = 1 (I/O Mode active)
  • D6, D5 = 0 1 (Port A in Mode 1)
  • D4 = 1 (Port A configured as Input)
  • D3 = 0 (In Mode 1 input for Port A, PC4 and PC5 are available; D3 controls PC7–PC6 as I/O if unused, set to 0)
  • D2 = 1 (Port B in Mode 1)
  • D1 = 0 (Port B configured as Output)
  • D0 = 0 (Port C Lower unused pin direction, set to 0)

Bit string: D7 D6 D5 D4 D3 D2 D1 D0 = 1 0 1 1 0 1 0 0 B = B4H

Identify Port C Handshake Line Assignments: In this dual Mode 1 configuration:

  • Port A (Input):
    • PC4 = STB_A_bar (Strobe Input from external peripheral)
    • PC5 = IBF_A (Input Buffer Full status output to peripheral)
    • PC3 = INTR_A (Interrupt Request output to CPU)
  • Port B (Output):
    • PC1 = OBF_B_bar (Output Buffer Full output to peripheral)
    • PC2 = ACK_B_bar (Acknowledge input from peripheral)
    • PC0 = INTR_B (Interrupt Request output to CPU)
  • Remaining Pins (PC6, PC7):
    • Configured as general-purpose I/O lines.
Answer:

The control word is B4H (10110100B). Port A uses PC4 (STB_bar), PC5 (IBF), and PC3 (INTR); Port B uses PC1 (OBF_bar), PC2 (ACK_bar), and PC0 (INTR).


Exercises

Exercises

Question 1

Explain the internal architecture of the Intel 8255A Programmable Peripheral Interface (PPI) with a clean block diagram. Describe the functions of the Data Bus Buffer, Read/Write Control Logic, and Group A/Group B controls.

Overview and Block Diagram: The Intel 8255A is a 40-pin programmable device providing 24 I/O pins organized into three 8-bit ports (A, B, C). It contains five main functional blocks:

Text
+-----------------------------------------------------------------+
|                       INTEL 8255A PPI                           |
|                                                                 |
|  +--------------------+   8-bit Internal Bus   +--------------+ |
|  | Data Bus Buffer    |<======================>| Group A      | |
|  | D7–D0 (To System)  |                        | Control      | |
|  +--------------------+                        +-------+------+ |
|                                                        |        |
|  +--------------------+                        +-------v------+ |
|  | Read / Write &     |                        | Port A (8)   | |
|  | Control Logic      |                        | PA7–PA0      | |
|  | - CS_bar           |                        +--------------+ |
|  | - RD_bar           |                                |        |
|  | - WR_bar           |                        +-------v------+ |
|  | - A1, A0           |                        | Port C Upper | |
|  | - RESET            |                        | PC7–PC4 (4)  | |
|  +--------------------+                        +--------------+ |
|                                                                 |
|                                                +--------------+ |
|                                                | Group B      | |
|                                                | Control      | |
|                                                +-------+------+ |
|                                                        |        |
|                                                +-------v------+ |
|                                                | Port B (8)   | |
|                                                | PB7–PB0      | |
|                                                +--------------+ |
|                                                        |        |
|                                                +-------v------+ |
|                                                | Port C Lower | |
|                                                | PC3–PC0 (4)  | |
|                                                +--------------+ |
+-----------------------------------------------------------------+

Detailed Function of Functional Blocks:

  1. Data Bus Buffer: An 8-bit bidirectional tri-state buffer connecting internal 8255A buses to system data lines D7–D0. It transfers data, control words, and status information.
  2. Read/Write and Control Logic: Decodes bus operations:
    • CS_bar: Active LOW chip enable.
    • RD_bar: Active LOW read strobe.
    • WR_bar: Active LOW write strobe.
    • A1, A0: Selects Port A (00), Port B (01), Port C (10), or Control Register (11).
    • RESET: Active HIGH pulse resets all ports to Mode 0 input.
  3. Group A and Group B Control Blocks:
    • Group A: Interprets control register commands to configure Port A (PA7–PA0) and Port C Upper (PC7–PC4).
    • Group B: Interprets control register commands to configure Port B (PB7–PB0) and Port C Lower (PC3–PC0).
Answer:

The 8255A consists of a Data Bus Buffer (D7–D0), Read/Write Control Logic (CS, RD, WR, A1, A0, RESET), Group A Control (governing Port A and PC7–PC4), and Group B Control (governing Port B and PC3–PC0), providing 24 configurable I/O pins across three ports.

Question 2

Derive the 8255A I/O Control Word for the following system requirement:

Express the control byte in binary and hexadecimal. Write an assembly code snippet to write this control word to the control register mapped at I/O address 0BH.

Formulate Control Word Bits:

  • D7 = 1 (I/O Mode selection)
  • D6, D5 = 0 0 (Port A in Mode 0)
  • D4 = 0 (Port A = Output)
  • D3 = 0 (Port C Upper = Output)
  • D2 = 0 (Port B in Mode 0)
  • D1 = 1 (Port B = Input)
  • D0 = 1 (Port C Lower = Input)

Assembled binary string: D7 D6 D5 D4 D3 D2 D1 D0 = 1 0 0 0 0 0 1 1 B = 83H

Assembly Code Snippet:

8085 ASM
MVI A,83H
OUT 0BH

Execution:

  1. MVI A,83H: Loads 83H into Accumulator.
  2. OUT 0BH: Writes 83H into Control Register at address 0BH.
Answer:

The I/O Control Word is 83H (10000011B). The assembly instructions are MVI A,83H followed by OUT 0BH.

Question 3

Explain the Bit Set/Reset (BSR) mode of the Intel 8255A PPI. What is its primary advantage over standard port writing? Formulate the exact BSR control words to:

  1. SET pin PC7
  2. RESET pin PC7
  3. SET pin PC0
  4. RESET pin PC0

BSR Mode Operation and Advantage: BSR mode is selected whenever bit D7 of the byte written to the Control Register (address A1=1, A0=1) is 0. It allows software to set or reset any single bit of Port C independently.

Primary Advantage: To alter one bit of an output port using standard port writes, the CPU must read the port, perform bitwise masking/ORing, and write the byte back (read-modify-write). If the port pins are driving external hardware or cannot be read cleanly, this risks glitching adjacent bits. In contrast, BSR mode directly changes the targeted Port C latch bit in hardware in a single OUT instruction without altering or glitching any other Port C pin.

Formulate Control Words: Format: 0 0 0 0 [D3 D2 D1] D0

  • PC7 (Bit select 111):
    • SET PC7 (D0=1): 0000 1111B = 0FH
    • RESET PC7 (D0=0): 0000 1110B = 0EH
  • PC0 (Bit select 000):
    • SET PC0 (D0=1): 0000 0001B = 01H
    • RESET PC0 (D0=0): 0000 0000B = 00H
Answer:

BSR mode sets or resets any single bit of Port C without affecting other bits. The control words are: SET PC7 = 0FH, RESET PC7 = 0EH, SET PC0 = 01H, RESET PC0 = 00H.

Question 4

Compare Single Handshaking and Double Handshaking in parallel data communication. Explain why Double Handshaking is completely speed-independent and immune to timing variations.

Comparison of Handshaking Mechanisms:

  1. Control Line Protocol: Single handshaking sends a single strobe pulse from the sender, and the receiver optionally returns an acknowledge pulse. Double handshaking implements an interlocking four-phase request-acknowledge loop (DAV and DAC).
  2. Timing Dependency: Single handshaking assumes the receiving device will latch or process the byte within a fixed pulse duration. Double handshaking has zero timing assumptions; state transitions happen only after the partner responds.
  3. Transmission Speed: Single handshaking is faster because it completes in fewer signal edges. Double handshaking adapts dynamically to the slower device.
  4. Reliability: Double handshaking provides absolute reliability over noisy or high-capacitance lines because data is never removed from the bus until the receiver has actively asserted that the data was captured.

Why Double Handshaking is Speed-Independent: In double handshaking:

  • The sender asserts DAV = HIGH and waits indefinitely.
  • The receiver asserts DAC = HIGH only after it has completed reading the data into its buffer.
  • The sender removes data and de-asserts DAV = LOW only after witnessing DAC = HIGH.
  • The receiver returns DAC = LOW only after witnessing DAV = LOW.

Because no step occurs based on a timer or clock pulse, the system operates correctly whether the receiver takes 10 nanoseconds or 10 seconds to respond.

Answer:

Single handshaking uses pulse-based strobes with fixed timing assumptions. Double handshaking uses a four-phase closed loop (DAV/DAC) where each party waits for the other's explicit signal transition, making it fully asynchronous, speed-independent, and robust against timing variations.

Question 5

An 8255A PPI is interfaced to an 8085 processor with base address 60H. Port A (60H) is connected to a common-cathode 7-segment display (Output, Mode 0). Port B (61H) is connected to an 8-bit DIP switch (Input, Mode 0).

  1. Determine the Control Word to configure Port A as Mode 0 Output and Port B as Mode 0 Input (with Port C configured as Mode 0 Output).
  2. Write an 8085 assembly program to read a BCD digit (0–9) from Port B, look up its 7-segment display code from a lookup table stored in memory at 2200H, and output the pattern to Port A.

Calculate Control Word:

  • D7 = 1 (I/O Mode)
  • D6, D5 = 0 0 (Port A in Mode 0)
  • D4 = 0 (Port A = Output)
  • D3 = 0 (Port C Upper = Output)
  • D2 = 0 (Port B in Mode 0)
  • D1 = 1 (Port B = Input)
  • D0 = 0 (Port C Lower = Output)

Control byte: 1 0 0 0 0 0 1 0 B = 82H Control Register address = base (60H) + 3 = 63H.

Assembly Language Program with Lookup Table:

8085 ASM
ORG 2000H
MVI A,82H
OUT 63H

IN 61H
ANI 0FH
MOV E,A
MVI D,00H
LXI H,2200H
DAD D
MOV A,M
OUT 60H
HLT

ORG 2200H
DB 3FH, 06H, 5BH, 4FH, 66H
DB 6DH, 7DH, 07H, 7FH, 6FH

Trace with Example Input: Assume Port B input is 05H (digit 5):

  1. IN 61H: Accumulator = 05H.
  2. ANI 0FH: Masks to ensure single BCD digit (A = 05H).
  3. MOV E,A and MVI D,00H: DE = 0005H.
  4. LXI H,2200H: HL points to base of 7-segment table.
  5. DAD D: Adds offset 0005H to HL; HL = 2205H.
  6. MOV A,M: Loads pattern at 2205H (6DH for digit 5) into Accumulator. MOV does not touch the flags, which still come from ANI 0FH on 05H (AC = 1, P = 1, S = Z = 0) and DAD D (CY = 0).
After Table Lookup
A6DH
B00H
C00H
D00H
E05H
H22H
L05H
S0
Z0
AC1
P1
CY0
  1. OUT 60H: Outputs 6DH to Port A, illuminating segments for digit 5.
Answer:

The control word is 82H written to Control Register 63H. The assembly routine reads the digit from Port 61H, computes the table offset via DAD D, fetches the 7-segment segment pattern from memory address 2200H + digit, and outputs the decoded byte to Port 60H.

Past exam questions for Microprocessors

← Memory Hierarchy & I/O/Memory Interfacing with 8085Serial Interface: RS-232, USB & USART →