Parallel Interface, Handshaking & the PPI
Open in the Padhaiko app4.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:
- 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.
- 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.
- Operation: The microprocessor executes an
INorOUTinstruction unconditionally. The data is read from the input buffer or written to the output latch immediately. - Typical Applications: Reading mechanical DIP switches, pushbuttons, or logic jumpers; writing to static 7-segment LED displays or indicator lamps.
- Limitation: Cannot be used with asynchronous or variable-speed devices (such as keyboards, printers, or analog-to-digital converters), as data may be read before it is valid or written before the device has consumed the previous byte.
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.
- Operation:
- The microprocessor initiates an I/O read or write cycle and places the port address on the bus during T1.
- The slow peripheral detects its address and asserts the microprocessor READY pin LOW (pin 35 of the 8085).
- The 8085 samples the READY pin during the trailing edge of clock period T2.
- If READY is LOW, the processor inserts one or more idle clock cycles called Wait States (Tw) between T2 and T3.
- During Tw, the address bus, data bus, and control signals remain completely frozen in their active states.
- When the peripheral finishes its data preparation or latching, it drives the READY pin HIGH.
- The 8085 resumes the normal machine cycle, moving from Tw to T3 to complete the data transfer.
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.
- Input Handshaking Sequence:
- The external peripheral places a byte of data on the input lines and asserts an active-low Strobe signal (
STB_bar). - The interface port latches the data and asserts an Input Buffer Full (IBF) status flag HIGH to inform the sender that data is held in the latch.
- The processor polls the status flag (or is interrupted via an
INTRline) and executes anINinstruction. - Reading the port automatically clears the
IBFline back to LOW, signaling the peripheral that the latch is empty and ready for the next byte.
- The external peripheral places a byte of data on the input lines and asserts an active-low Strobe signal (
- Output Handshaking Sequence:
- The processor writes data to the output port using an
OUTinstruction. - The interface latches the byte and asserts Output Buffer Full (
OBF_bar) LOW, informing the peripheral that valid data is waiting. - The peripheral reads the data and returns an active-low Acknowledge pulse (
ACK_bar). - The rising edge of
ACK_barautomatically de-assertsOBF_barback to HIGH.
- The processor writes data to the output port using an
- Limitation: Single handshaking relies on pulse-width timing. If the receiver misses the narrow pulse or takes too long to react, data may be overwritten or lost.
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.
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:
- Phase 1 (Sender Request): The sender places valid data on the parallel data lines and, after allowing for signal settling time, asserts
DAV = HIGH. - Phase 2 (Receiver Acknowledge): The receiver senses
DAV = HIGH, reads the data lines into its internal buffer, and assertsDAC = HIGHto confirm reception. - 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-assertsDAV = LOW. - Phase 4 (Receiver Reset): The receiver detects that
DAVhas returned to LOW and de-assertsDAC = LOW. Both lines are now in the idle state, ready for the next transfer.
| Mode | Control Lines | Synchronization Mechanism | Transfer Speed | Hardware Complexity | Typical Peripheral |
|---|---|---|---|---|---|
| Simple I/O | None | Unconditional; assumes device always ready | Maximum bus rate | Lowest (buffer or latch only) | DIP switches, LED status bar |
| Wait State I/O | 1 (READY line) | CPU enters idle clock cycles (Tw) | Slower; throttled to device speed | Minimal (delay generator / counter) | Slow EPROM, ADC conversion cycle |
| Single Handshaking | 2 (Strobe + Buffer Full / Ack) | Pulse-based strobe and status flag | Medium; coordinated per byte | Moderate (status latch + flip-flops) | Dot-matrix printer (Centronics interface) |
| Double Handshaking | 2 (DAV + DAC lines) | Fully interlocked 4-phase closed loop | Variable; asynchronous and robust | Higher (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.
+--------------------+
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 PPIInternal Functional Architecture
The 8255A consists of four primary internal functional sections:
- 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.
- 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.
- 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).
- 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.
| CS_bar | A1 | A0 | RD_bar | WR_bar | Selected Internal Operation |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | Read Port A data onto D7–D0 |
| 0 | 0 | 1 | 0 | 1 | Read Port B data onto D7–D0 |
| 0 | 1 | 0 | 0 | 1 | Read Port C data onto D7–D0 |
| 0 | 0 | 0 | 1 | 0 | Write D7–D0 data into Port A latch |
| 0 | 0 | 1 | 1 | 0 | Write D7–D0 data into Port B latch |
| 0 | 1 | 0 | 1 | 0 | Write D7–D0 data into Port C latch |
| 0 | 1 | 1 | 1 | 0 | Write Control Word into Control Register |
| 0 | 1 | 1 | 0 | 1 | Illegal Condition (Control Register cannot be read directly) |
| 1 | X | X | X | X | 8255A 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:
- Bit Set/Reset (BSR) Mode (D7 = 0)
- 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.
+----+----+----+----+----+----+----+----+
| 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| D3 | D2 | D1 | Selected Port C Bit | Control Word for SET (D0=1) | Control Word for RESET (D0=0) |
|---|---|---|---|---|---|
| 0 | 0 | 0 | PC0 | 0000 0001B (01H) | 0000 0000B (00H) |
| 0 | 0 | 1 | PC1 | 0000 0011B (03H) | 0000 0010B (02H) |
| 0 | 1 | 0 | PC2 | 0000 0101B (05H) | 0000 0100B (04H) |
| 0 | 1 | 1 | PC3 | 0000 0111B (07H) | 0000 0110B (06H) |
| 1 | 0 | 0 | PC4 | 0000 1001B (09H) | 0000 1000B (08H) |
| 1 | 0 | 1 | PC5 | 0000 1011B (0BH) | 0000 1010B (0AH) |
| 1 | 1 | 0 | PC6 | 0000 1101B (0DH) | 0000 1100B (0CH) |
| 1 | 1 | 1 | PC7 | 0000 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.
+----+----+----+----+----+----+----+----+
| 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- Port A Mode Specification (D6, D5):
0 0: Mode 0 (Basic Input/Output)0 1: Mode 1 (Strobed Input/Output)1 X: Mode 2 (Bidirectional Bus)
- Port B Mode Specification (D2):
0: Mode 0 (Basic Input/Output)1: Mode 1 (Strobed Input/Output)
Summary of the Three I/O Modes
- 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.
- 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.
- Port A Input:
- 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
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:
- Port A (80H) is connected to an 8-bit DIP switch bank (Input).
- Port B (81H) is connected to an 8-bit LED display (Output).
- Port C Upper (PC7–PC4) is configured as Input.
- Port C Lower (PC3–PC0) is configured as Output.
- Construct the 8-bit I/O Control Word in binary and hexadecimal.
- 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:
ORG 2000H
MVI A,98H
OUT 83H
READ:
IN 80H
OUT 81H
JMP READInstruction Trace and Register States:
MVI A,98H: Loads control word 98H into Accumulator.
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.IN 80H: Reads DIP switch data (assume 3CH = 0011 1100B) into Accumulator.
OUT 81H: Writes 3CH from Accumulator to Port B LEDs.
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.
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:
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
RETExecution Trace:
MVI A,09Hfollowed byOUT 03H: Writes 09H into Control Register 03H. Internal logic sets pin PC4 HIGH (5V).
CALL DELAYpauses execution for the HIGH duration of the square wave.MVI A,08Hfollowed byOUT 03H: Writes 08H into Control Register 03H. Internal logic resets pin PC4 LOW (0V).
CALL DELAYpauses execution for the LOW duration. TheJMP WAVErepeats the cycle indefinitely, producing a periodic square wave on pin PC4.
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.
Mode 1 Strobed Handshake Control Word Formulation
Configure the Intel 8255A PPI to operate with:
- Port A as a Strobed Input port (Mode 1)
- Port B as a Strobed Output port (Mode 1)
- Unused pins of Port C (PC4, PC5) as simple input lines
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.
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
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:
+-----------------------------------------------------------------+
| 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:
- 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.
- 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.
- 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).
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.
Derive the 8255A I/O Control Word for the following system requirement:
- Port A configured as Mode 0 Output
- Port B configured as Mode 0 Input
- Port C Upper (PC7–PC4) configured as Output
- Port C Lower (PC3–PC0) configured as Input
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:
MVI A,83H
OUT 0BHExecution:
MVI A,83H: Loads 83H into Accumulator.OUT 0BH: Writes 83H into Control Register at address 0BH.
The I/O Control Word is 83H (10000011B). The assembly instructions are MVI A,83H followed by OUT 0BH.
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:
- SET pin PC7
- RESET pin PC7
- SET pin PC0
- 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
- SET PC7 (D0=1):
- PC0 (Bit select 000):
- SET PC0 (D0=1):
0000 0001B = 01H - RESET PC0 (D0=0):
0000 0000B = 00H
- SET PC0 (D0=1):
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.
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:
- 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 (
DAVandDAC). - 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.
- Transmission Speed: Single handshaking is faster because it completes in fewer signal edges. Double handshaking adapts dynamically to the slower device.
- 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 = HIGHand waits indefinitely. - The receiver asserts
DAC = HIGHonly after it has completed reading the data into its buffer. - The sender removes data and de-asserts
DAV = LOWonly after witnessingDAC = HIGH. - The receiver returns
DAC = LOWonly after witnessingDAV = 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.
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.
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).
- 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).
- 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:
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, 6FHTrace with Example Input: Assume Port B input is 05H (digit 5):
IN 61H: Accumulator = 05H.ANI 0FH: Masks to ensure single BCD digit (A = 05H).MOV E,AandMVI D,00H: DE = 0005H.LXI H,2200H: HL points to base of 7-segment table.DAD D: Adds offset 0005H to HL; HL = 2205H.MOV A,M: Loads pattern at 2205H (6DH for digit 5) into Accumulator.MOVdoes not touch the flags, which still come fromANI 0FHon05H(AC = 1,P = 1,S = Z = 0) andDAD D(CY = 0).
OUT 60H: Outputs 6DH to Port A, illuminating segments for digit 5.
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.