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

📝 Programming in Mode 1(strobed Input/Output) for 8255A (6 MCQs)

Configuring Port A and Port B for Strobed Transfers

Mode 1 programming configures Port A or Port B for input or output with hardware handshaking. Each port uses three associated Port C lines for coordination, status and interrupt requests. Unlike Mode 0, both input and output data are latched, allowing the processor and peripheral device to exchange information without requiring exact simultaneous operation.

Control Word Selection for Mode 1 Operation

D7 must be one to select I/O mode. Group A uses D6D5 equal to 01 for Mode 1, while D2 must be one to select Mode 1 for Group B. D4 selects Port A direction and D1 selects Port B direction. The remaining Port C bits are assigned according to the selected input or output handshake arrangement.

Programming the Handshake and Interrupt Functions

The processor first writes the Mode 1 control word into the control register. Port C signals then coordinate peripheral data readiness and acknowledgement. When interrupt-driven communication is required, the internal INTE flip-flop associated with the selected port must be enabled using BSR control of the appropriate Port C bit.

Example of Configuring Port A for Strobed Input

Assume the control register is at 83H and Port A at 80H. MVI A,B0H followed by OUT 83H selects Mode 1 input for Port A, Mode 0 output for Port B, and output direction for the available lower Port C lines. A peripheral can subsequently strobe input data into Port A for processor retrieval.

Data Latching and Peripheral Synchronization

Mode 1 supports reliable transfers when the peripheral operates at a different speed from the processor. Input latches preserve received information until the CPU reads it, while output latches retain transmitted data until the peripheral acknowledges acceptance. These facilities reduce dependence on continuous polling and support interrupt-based communication.

Misconceptions About Strobed I/O Configuration

'Mode 1 does not use Port C' is incorrect because Port C supplies handshake and status signals. 'Only input data is latched' overlooks output latching. 'Selecting Mode 1 automatically enables interrupts' is incorrect because the associated INTE flip-flop must also be enabled through BSR control.

Mode 1 Control Word and Handshake Programming Questions

Determine valid control words for Port A and Port B input or output configurations. Identify the three Port C handshake signals allocated to each port and locate the remaining general-purpose lines. Practise explaining INTE enable operations and tracing how the peripheral handshake permits safe input and output transfers.

Mode 1 Programming and Handshaking Terms

  • Mode 1 - Provides strobed input/output.
  • STB - Signals peripheral input readiness.
  • IBF - Indicates input buffer availability.
  • OBF - Indicates output buffer status.
  • ACK - Acknowledges peripheral data acceptance.
  • INTE - Enables interrupt requests.
1
Easy
3
Medium
2
Hard

📝 All Programming in Mode 1(strobed Input/Output) for 8255A MCQs

Q1. What operation does the CMA instruction perform on the accumulator in an 8085 program?

A.Increment the accumulator
B.Complement (bitwise NOT) the accumulator ✅
C.Rotate accumulator left
D.Store accumulator to memory
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The CMA instruction flips every bit in the accumulator, producing the 1’s complement of the original byte. This is why option B is correct. Incrementing the accumulator (option A) would add one, not invert bits. Rotating left (option C) moves bits cyclically without changing their values, and storing to memory (option D) does not modify the accumulator’s contents. Understanding CMA is essential when a program needs to invert data before further processing.

Q2. Why is it often advisable to store the result of a 1’s complement operation in a different memory location instead of overwriting the original byte?

A.To save execution cycles
B.To preserve the original data for later verification ✅
C.Because the 8085 cannot write to the same address
D.To avoid triggering a hardware interrupt
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Preserving the original byte allows the program to compare the complemented value with the source, perform additional checks, or restore the initial data if needed. Option B captures this rationale. Saving cycles (option A) is not guaranteed, as an extra store instruction adds overhead. The 8085 can certainly write to the same address (option C), so that statement is false. Overwriting data does not inherently cause hardware interrupts (option D), making it an incorrect choice.

Q3. Which instruction sequence correctly reads a byte from address 3000H, inverts its bits, stores the result at 3001H, adds the constant 5, and stores the final value at 3002H?

A.LDA 3000H; CMA; STA 3001H; MVI A,05H; ADD A; STA 3002H
B.LDA 3000H; CMA; STA 3001H; MVI A,05H; ADD 3001H; STA 3002H
C.LHLD 3000H; CMA; SHLD 3001H; INR A; STA 3002H
D.LXI H,3000H; MOV A,M; CMA; STA 3001H; ADI 05H; STA 3002H ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Option D follows the correct flow: it loads the byte with MOV A,M, complements it, stores the intermediate result, adds the immediate value 5 using ADI, and finally stores the summed result. Option A adds the accumulator to itself after loading 5, producing an incorrect value. Option B attempts to add the memory byte after loading 5, but the ADD instruction used is invalid for this context. Option C mixes register‑pair operations that do not apply to a single‑byte complement task. The correct sequence demonstrates proper use of the accumulator and immediate addition in 8085 programming.

Q4. In Mode 1 strobed I/O, what is the primary purpose of the START and STOP pulses generated by the peripheral?

A.They reset the microprocessor
B.They indicate the beginning and end of a data block ✅
C.They select the I/O address
D.They provide power to the device
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The START pulse tells the CPU that a transmission is about to begin, and the STOP pulse signals that the transfer has finished, allowing both sides to synchronize the timing of the data block. This makes option B correct. Resetting the processor (option A) requires a dedicated reset line, not the strobed pulses. Selecting an address (option C) is handled by address lines, not by START/STOP signals. Supplying power (option D) is unrelated to timing pulses, which merely coordinate communication phases.

Q5. To read a 16‑bit value from two consecutive I/O ports 20H (low byte) and 21H (high byte) using Mode 1 strobed I/O, which routine ensures correct ordering and combines the bytes into HL register?

A.IN 20H; MOV L,A; IN 21H; MOV H,A; XCHG ✅
B.IN 20H; MOV L,A; IN 21H; MOV H,A; DAD H,HL
C.IN 21H; MOV H,A; IN 20H; MOV L,A; XCHG
D.IN 20H; MOV L,A; IN 21H; MOV H,A; XCHG
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Option A reads the low byte first from port 20H into L, then reads the high byte from port 21H into H, and finally uses XCHG to place the combined 16‑bit value into HL, preserving correct byte order. Option B adds an unnecessary DAD instruction that would alter the contents. Option C reverses the order, putting the high byte into H before the low byte, which would swap the significance of the bytes. Option D uses XCHG without first loading both registers, leaving HL unchanged. The correct sequence reflects proper handling of low‑high ordering in strobed I/O.

Q6. When using a hand assembler that requires entry of hexadecimal op‑codes via a keypad, what is a key advantage compared to a machine assembler that accepts mnemonic instructions?

A.Faster program execution
B.Direct control over the exact machine code generated ✅
C.Automatic generation of comments
D.Built‑in error checking of syntax
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Entering raw op‑codes gives the programmer precise authority over each byte that will appear in memory, ensuring that no assembler‑generated optimization or re‑ordering occurs. This is why option B is correct. Faster execution (option A) depends on the code itself, not on entry method. Automatic comments (option C) are a feature of higher‑level tools, not hand assembly. Built‑in syntax checking (option D) is provided by machine assemblers, not by manual keypad entry, making those choices incorrect.)

🔗 Related Topics (MCQs)