🎓 BookMCQ
← Back to 8. Programmable Peripheral Interface (PPI) 8255A

📝 Programming in Mode 2 (Strobed Bidirectional Bus I/O) (21 MCQs)

Bidirectional Data Transfer Through Port A

Mode 2 configures Port A of the 8255A as an eight-bit bidirectional data bus supporting both input and output operations with handshaking. The same PA7–PA0 lines transmit information to a peripheral and receive information from it. Input and output latches retain transferred data, while associated handshake signals coordinate the direction and timing of communication.

Port C Handshake Signals and Group B Configuration

Mode 2 uses PC7 for OBF_A, PC6 for ACK_A, PC5 for IBF_A, PC4 for STB_A and PC3 for INTR_A. The lower Port C bits PC2–PC0 remain available for Group B operations. Port B can operate independently in Mode 0 or Mode 1 while Port A uses Mode 2.

Control Word and Bidirectional Transfer Initialization

D7 must be one and D6 must be one to select Mode 2 for Group A. The remaining Group B bits determine its mode and direction. Once the control word is written, the 8255A supports peripheral input and output through the same Port A data lines, using separate read and write handshakes.

Example of Configuring Port A for Bidirectional I/O

Assume Port A is at 80H and the control register at 83H. Execute MVI A,C0H followed by OUT 83H to select Mode 2 for Port A, with Group B in Mode 0 and Port B and lower Port C configured as outputs. IN 80H and OUT 80H subsequently read and transmit Port A data.

Bidirectional Handshaking and Peripheral Communication

For input, STB_A allows peripheral data to enter the input latch, and IBF_A indicates availability. For output, the processor writes data, OBF_A indicates pending output and ACK_A confirms acceptance. INTR_A supports interrupt requests for both directions when the corresponding internal interrupt-enable conditions are satisfied.

Misconceptions About Mode 2 Operation

'Mode 2 can be selected for Port B' is incorrect because it is available only for Port A. 'Port A uses separate eight-bit input and output ports' is incorrect because the same data lines are bidirectional. 'All eight Port C lines remain ordinary I/O' overlooks the five handshake assignments on PC3–PC7.

Mode 2 Control Word and Bidirectional Timing Questions

Identify the five Port A handshake signals and explain their input and output functions. Practise interpreting Group A Mode 2 control-word settings and the independent Group B configuration. Trace peripheral-to-8255A and 8255A-to-peripheral transfers, including the roles of STB, IBF, OBF, ACK and INTR.

Mode 2 Bidirectional Transfer Terminology

  • Mode 2 - Strobed bidirectional Port A operation.
  • STB_A - Strobes incoming peripheral data.
  • IBF_A - Indicates received data availability.
  • OBF_A - Indicates pending output data.
  • ACK_A - Acknowledges accepted output data.
  • INTR_A - Requests processor service.
6
Easy
9
Medium
6
Hard

📝 All Programming in Mode 2 (Strobed Bidirectional Bus I/O) MCQs

Q1. What is the hexadecimal opcode for the LDA instruction that loads the accumulator from a memory address in 8085?

A.3A ✅
B.32
C.C6
D.76
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The LDA instruction uses the opcode 3A followed by a 16‑bit address. Option A is the correct opcode, while 32 is the opcode for STA, C6 is for MVI A, and 76 is the HLT instruction. Knowing the exact opcode is essential when writing hand‑assembled programs, because an incorrect opcode would cause the processor to execute the wrong operation, leading to faulty I/O handling.

Q2. In Mode 2 strobed I/O, which register provides the high‑order eight bits of the 16‑bit I/O address?

A.A ✅
B.B
C.C
D.D
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The high‑order byte of the I/O address is taken from the accumulator (register A), making option A correct. Registers B, C, and H are not used for the high‑order address in this mode. This design allows the programmer to set the upper address byte directly, simplifying address formation for devices that require a full 16‑bit address on the shared bus.

Q3. Why does Mode 2 use a strobe signal together with the bidirectional data bus instead of a separate address bus?

A.It reduces pin count
B.It increases speed ✅
C.It simplifies timing
D.It allows DMA
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The strobe signal synchronizes data transfer on the bidirectional bus, eliminating the need for a dedicated address bus and thus reducing the number of pins required on the microprocessor package. Option B correctly captures this advantage. The other options either describe unrelated benefits or are inaccurate: speed is not directly increased, timing simplification is a secondary effect, and DMA is unrelated to the strobe concept.

Q4. How does the Strobed Bidirectional Bus I/O mode prevent bus contention when the same device must both send and receive data?

A.By using separate lines
B.By using time‑division multiplexing
C.By disabling the processor ✅
D.By using a tri‑state buffer
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: In Mode 2 the processor and peripheral share the same data lines, but only one driver is enabled at a time. The correct mechanism is time‑division multiplexing (option C), where the strobe determines whether the processor or the device is driving the bus. Separate lines would defeat the purpose of a shared bus, disabling the processor would halt operation, and a tri‑state buffer alone does not resolve contention without proper timing control.

Q5. If an 8085 program needs to read a byte from an I/O device at address 0x5A3F using Mode 2, which sequence correctly forms the address and initiates the read?

A.LDA 5A3F
B.OUT 5A
C.IN 5A
D.IN A ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The correct sequence is to load the high‑order byte (A ← 5A) and then execute IN A, which uses the strobe to read from the full address 0x5A3F. Option D reflects this. LDA 5A3F would read from memory, not I/O. OUT 5A writes to the device, and IN 5A reads only from the low‑order address, missing the high‑order part.

Q6. A designer wants to implement a bidirectional data line that can also act as an address line during the strobe phase. Which hardware feature makes this feasible in the 8085?

A.Tri‑state drivers ✅
B.Open‑collector outputs
C.Push‑pull buffers
D.Series resistors
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Tri‑state drivers allow a line to be driven high, driven low, or placed in a high‑impedance state, enabling the same pins to carry address information during the strobe and data during normal cycles. This is why option A is correct. Open‑collector outputs cannot source current, push‑pull buffers cannot become high‑impedance, and series resistors only limit current without providing full multiplexing capability.

Q7. When using Mode 2, what happens if the strobe signal is asserted while the processor is still driving the data bus?

A.Data is overwritten
B.Bus error occurs
C.Processor stalls ✅
D.No effect
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: If the strobe is asserted while the processor is still driving the bus, the processor will automatically place its drivers in high‑impedance, preventing a clash; this is the intended behavior, making option C correct. Data would not be overwritten because the hardware ensures only one driver is active. A bus error is not generated, and the strobe does have an effect on bus control.

Q8. Which of the following best describes the role of the I/O address register (IOAR) in Mode 2 operations?

A.It holds the low‑order address byte ✅
B.It holds the high‑order address byte
C.It generates the strobe signal
D.It buffers data
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The IOAR supplies the low‑order eight bits of the 16‑bit I/O address, while the accumulator provides the high‑order byte. Therefore option A is correct. The high‑order byte comes from A, not the IOAR; the strobe is generated by control logic, and buffering is handled by separate circuitry.

Q9. A student writes a program that uses IN A to read from an I/O device, but the device never receives the address. Which mistake is most likely?

A.Forgot to load A ✅
B.Used wrong opcode
C.Enabled interrupts
D.Missing a NOP
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: In Mode 2 the address is formed from A and the IOAR. If A is not loaded with the high‑order byte, the device will see an incorrect address, making option A the most probable error. Using the wrong opcode would cause a different operation, enabling interrupts does not affect address formation, and a missing NOP would not prevent address transmission.

Q10. Consider a system where two peripherals share the same strobed bus. Which method ensures that only one peripheral responds at a time?

A.Address decoding
B.Priority encoder
C.Bus arbitration logic
D.All of the above ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: All three techniques are typically combined to guarantee exclusive access: address decoding selects the device, a priority encoder resolves conflicts, and bus arbitration logic enforces timing. Hence option D is correct. Using any single method alone would leave scenarios where multiple devices could still contend for the bus.

Q11. If the high‑order address byte is 0x3C and the low‑order byte is stored in the IOAR as 0x7A, what is the full 16‑bit I/O address used by the 8085 in Mode 2?

A.15482 ✅
B.31292
C.14972
D.31802
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The full address concatenates the high‑order byte from A (0x3C) with the low‑order byte from the IOAR (0x7A), yielding 0x3C7A. Option A reflects this composition. The other options incorrectly swap or mix the bytes, which would direct the processor to the wrong device and cause communication failures.

Q12. A firmware routine must write a byte to a memory‑mapped I/O register located at 0xE200, then immediately read back the same location using Mode 2. Which instruction sequence accomplishes this without corrupting the address?

A.STA E200
B.IN A ✅
C.OUT A
D.LDAX D
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The correct sequence is to store the byte with STA E200, then load the high‑order byte into A (A←E2) and execute IN A, which reads from the full address 0xE200. Option B captures this logic. Using STA E200 alone does not read back, IN A without setting A reads the wrong address, and LDAX D accesses memory, not I/O.

Q13. Why is it advantageous to use Mode 2 for devices that require more than 256 I/O ports?

A.It expands address space ✅
B.It reduces power
C.It simplifies code
D.It enables DMA
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Mode 2 combines an 8‑bit high‑order byte from A with the 8‑bit IOAR, giving a 16‑bit address space of 65,536 ports, far exceeding the 256‑port limit of Mode 1. This expansion (option A) lets designers map many devices without additional hardware. Power reduction, code simplification, and DMA are not direct consequences of the address width increase.

Q14. During a Mode 2 read cycle, which control line indicates that the peripheral should place data on the bus?

A.SID
B.IO/M
C.WR
D.IN ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The IN line (option D) signals that the peripheral must drive the data bus with the requested byte. SID is a status line, IO/M distinguishes I/O from memory cycles, and WR is used for write operations, so they do not trigger a read response.

Q15. A system designer replaces the external strobe generator with a software‑controlled toggle. What risk does this introduce compared to the hardware strobe?

A.Increased latency
B.Reduced address accuracy
C.Potential bus contention ✅
D.Lower voltage
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Software toggling can mis‑time the enable of the peripheral, leading to a situation where both the CPU and the device try to drive the bus simultaneously, creating contention (option C). Latency may increase, but the primary hazard is the loss of precise hardware timing that guarantees exclusive bus control.

Q16. Which of the following statements correctly explains why the 8085’s IN instruction cannot be used for memory‑mapped I/O in Mode 2?

A.IN only works with address bus
B.IN requires a strobe
C.Memory‑mapped I/O uses different opcode
D.IN accesses only 8‑bit ports ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The IN instruction is defined for I/O space and uses the strobe mechanism; it does not address memory locations, making option D accurate. Memory‑mapped I/O would require MOV or other instructions that reference the HL pair, while the opcode itself is not the limiting factor. The need for a strobe is inherent to Mode 2 but does not prevent IN from working with I/O addresses.

Q17. If a programmer accidentally writes the high‑order address byte to register B instead of A before an IN A, what will be the observed behavior?

A.Correct address
B.Incorrect address ✅
C.No data transferred
D.Processor crash
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Register B is not used to form the I/O address in Mode 2; the high‑order byte must reside in A. Consequently the processor will combine the contents of A (likely unchanged) with the IOAR, resulting in an incorrect address and a failed read (option B). The operation will not cause a crash, and some data may be transferred from the wrong device, but the address will be wrong.

Q18. A microcontroller communicates with an 8085 using a shared data bus. Which configuration ensures that the 8085 can both send commands and receive status without external arbitration hardware?

A.Use separate lines for commands
B.Use the same lines with tri‑state buffers ✅
C.Use DMA
D.Use a single‑ended driver
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Tri‑state buffers allow each device to place its drivers in a high‑impedance state when not active, enabling the shared bus to be safely used for both directions without external arbitration. Option B correctly describes this solution. Separate lines defeat the purpose of sharing, DMA is unrelated, and a single‑ended driver cannot release the bus.

Q19. When designing a Mode 2 interface, why is it important to debounce the external strobe signal?

A.To avoid false reads ✅
B.To increase speed
C.To reduce power consumption
D.To simplify code
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Mechanical switches can generate multiple transitions (bounce) when toggled, causing the processor to interpret several strobes as separate read or write cycles. Debouncing removes these spurious edges, ensuring only one legitimate operation per toggle (option A). Without debouncing, the CPU might read or write incorrect data, compromising system reliability.

Q20. Which flag in the 8085 status register is affected by the CMA instruction used to obtain a 1's complement?

A.Zero flag
B.Sign flag
C.Parity flag
D.Carry flag ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: The CMA instruction inverts every bit in the accumulator but does not affect any status flags; therefore none of the listed flags change. However, when forced to choose, the Carry flag remains unchanged, making option D the best answer. The other flags (Zero, Sign, Parity) are also unaffected, but the question asks which flag is affected, and the correct response is that none are, so the Carry flag answer reflects that it stays the same.

Q21. If an 8085 program repeatedly polls an I/O device using IN A, which technique can reduce CPU idle time while waiting for the device to become ready?

A.Increase clock speed
B.Use DMA
C.Insert a NOP loop
D.Use interrupt‑driven I/O ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Interrupt‑driven I/O allows the device to signal the processor when data is available, eliminating the need for continuous polling and freeing CPU cycles for other tasks. Option D captures this benefit. Raising the clock speed does not address waiting, DMA is for bulk transfers, and a NOP loop merely wastes time.

🔗 Related Topics (MCQs)