šŸŽ“ BookMCQ
← Back to 8. Programmable Peripheral Interface (PPI) 8255A

šŸ“ Control Word Format for 8255A (11 MCQs)

Eight-Bit Control Word and Operating Mode Selection

The 8255A uses an eight-bit control word to configure its ports and select their operating modes. The control register receives this word through the processor data bus. Its most significant bit, D7, distinguishes I/O configuration mode from Bit Set/Reset mode. When D7 is one, the remaining bits determine the direction and operating mode of the port groups.

Bit Assignments for Group A and Group B

In I/O mode, D6 and D5 select the Group A mode: 00 for Mode 0, 01 for Mode 1 and 1X for Mode 2. D4 selects Port A direction, and D3 selects the upper Port C direction. D2 selects Group B mode, D1 selects Port B direction, and D0 selects lower Port C direction. A one indicates input and zero indicates output where direction selection applies.

Distinguishing I/O Configuration from BSR Control

When D7 is zero, the control word operates in Bit Set/Reset mode. Bits D3–D1 select an individual Port C bit, while D0 determines whether that bit is set or reset. D6–D4 are not used for bit selection. This operation allows individual Port C output bits or associated interrupt-enable flip-flops to be controlled.

Example of Calculating a Port Configuration Word

Consider 10000011B, equivalent to 83H. D7 selects I/O mode, D6D5 select Mode 0 for Group A, D4 and D3 configure Port A and upper Port C as outputs, D2 selects Mode 0 for Group B, and D1D0 configure Port B and lower Port C as inputs.

Writing Control Words into the 8255A Control Register

The processor writes a configuration word by selecting the control register through A1A0 equal to 11, enabling the device and activating WR. The control word establishes port directions, operating modes and relevant handshaking arrangements. A new I/O-mode control word reconfigures the ports, while a BSR word changes individual Port C control bits.

Misconceptions About Control Word Bit Positions

'D7 equal to zero selects I/O mode' reverses the control-word selection because zero identifies BSR mode. 'D4 selects Port B direction' is incorrect because it determines Port A direction. 'D0 selects the Group B mode' is incorrect because D2 controls Group B mode, whereas D0 controls lower Port C direction.

Control Word Construction and Binary Interpretation Questions

Practise converting binary control words into hexadecimal and interpreting every bit position. Distinguish D7-based mode selection from individual port-direction settings. Calculate suitable words for Mode 0, Mode 1 and Mode 2 configurations, and determine which Port C lines become general-purpose I/O or handshaking signals.

Control Word and Bit-Selection Terminology

  • D7 - Selects I/O or BSR mode.
  • D6-D5 - Select Group A mode.
  • D2 - Selects Group B mode.
  • D4-D0 - Specify port directions and settings.
  • I/O Mode - Configures port operation.
  • BSR Mode - Controls individual Port C bits.
2
Easy
5
Medium
4
Hard

šŸ“ All Control Word Format for 8255A MCQs

Q1. Which bits in the 8255A control word select the operating mode for Group A?

A.D7
B.D6 and D5 āœ…
C.D4
D.D3
šŸ’” Difficulty: easy | āœ… Correct: B

šŸ“– Explanation: The control word uses bits D6 and D5 to define the mode for Group A (00 = Mode 0, 01 = Mode 1, 10 = Mode 2). Bit D7 merely indicates that a mode‑set operation is being performed, while D4 controls Group B mode and D3 is a direction bit. Selecting the correct pair of bits ensures the processor configures the desired I/O mode, which is essential for reliable hardware interfacing.

Q2. Why must bit D7 be set to 1 when programming the 8255A control word?

A.It enables the mode‑set operation āœ…
B.It disables the chip
C.It selects Port A as output
D.It selects Port B as input
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: Bit D7 acts as the mode‑set enable flag; when it is 1 the 8255A interprets the remaining bits as a new configuration. If D7 were 0, the word would be ignored and the chip would retain its previous settings, leading to unexpected I/O behavior. Therefore the processor must assert D7 = 1 to change modes, a requirement for any correct initialization sequence.

Q3. In Mode 0, what effect does setting bit D3 to 1 have on Port C?

A.Port C becomes an input port
B.Port C upper (PC7‑4) becomes an output port āœ…
C.Port C lower (PC3‑0) becomes an output port
D.Port C is disabled
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: In Mode 0 each direction bit controls a separate half of Port C. Bit D3 governs the upper half (PC7‑4). When D3 = 1 the upper half is configured as an output, allowing the microprocessor to drive external devices. The lower half remains unaffected by D3, so only the specified half changes direction, which is crucial when designing mixed‑direction I/O schemes.

Q4. A system requires Port A as input, Port B as output, the upper half of Port C as output and the lower half as input, all in Mode 0. Which control word should be loaded?

A.128
B.145
C.137 āœ…
D.193
šŸ’” Difficulty: medium | āœ… Correct: C

šŸ“– Explanation: To meet the requirements, set D7=1 (mode‑set), D6‑D5=00 (Mode 0 for Group A), D4=0 (Mode 0 for Group B). Direction bits then are D3=1 (PC7‑4 output), D2=0 (PC3‑0 input), D1=0 (Port A input), D0=1 (Port B output). This yields the binary pattern 10001001, which is hexadecimal 0x89. Loading this value programs the 8255A exactly as needed for the mixed‑direction configuration.

Q5. When configuring the 8255A for Group A Mode 1 (strobed I/O) with PC7‑4 as output handshake lines, PC3‑0 as input status lines, and Port B as output, which control word is appropriate?

A.169 āœ…
B.153
C.177
D.201
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: Mode 1 uses D6‑D5=01, so D6=0 and D5=1. D4 stays 0 for Group B Mode 0. Direction bits: D3=1 (PC7‑4 output), D2=0 (PC3‑0 input), D1=0 (Port A input for strobed operation), D0=1 (Port B output). Combining these gives 10101001ā‚‚, which equals 0xA9. This control word correctly enables the handshake and status lines while keeping Port B ready for output.

Q6. A designer wants Group A in Mode 2 (bidirectional) while keeping Group B in Mode 0, Port B as output, PC upper half as output, PC lower half as input, and Port A bidirectional. Which control word should be used?

A.139
B.203 āœ…
C.171
D.155
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Mode 2 for Group A requires D6‑D5=10, so D6=1 and D5=0. Group B remains in Mode 0 (D4=0). Direction bits: D3=1 (PC7‑4 output), D2=0 (PC3‑0 input), D1=1 (Port A enabled for bidirectional operation), D0=1 (Port B output). The resulting binary pattern is 11001011ā‚‚, which is 0xCB. Loading this value configures the chip exactly as described.

Q7. Why is Mode 2 only available for Group A and not for Group B in the 8255A?

A.Group A has more pins than Group B
B.Group B pins are fixed‑function and cannot support bidirectional data
C.Group B operates at a higher voltage āœ…
D.Group A is physically larger
šŸ’” Difficulty: hard | āœ… Correct: C

šŸ“– Explanation: Group B consists solely of Port B, which is a simple 8‑bit output port; its hardware does not include the necessary bidirectional buffers and handshake circuitry required for Mode 2. Group A, however, includes both Port A and Port C, providing the extra lines and internal structures needed for bidirectional communication. Consequently, the chip’s design restricts Mode 2 to Group A, ensuring reliable operation without over‑complicating Group B’s simpler architecture.

Q8. After a reset, a programmer writes the control word 0x80 to the 8255A. What mode and port directions are now active?

A.Mode 0, all ports set as inputs āœ…
B.Mode 1, Port A output only
C.Mode 2, Port B output only
D.Mode 0, all ports set as outputs
šŸ’” Difficulty: hard | āœ… Correct: A

šŸ“– Explanation: The value 0x80 translates to binary 1000 0000. D7=1 activates mode‑set, D6‑D5=00 selects Mode 0 for Group A, and D4=0 selects Mode 0 for Group B. All direction bits D3‑D0 are 0, meaning every port (Port A, Port B, and both halves of Port C) is configured as an input. This configuration is typical after reset when the designer wants to prevent accidental driving of external circuits until proper initialization occurs.

Q9. To toggle the PB pin on every interrupt, which initial control word should be programmed?

A.129 āœ…
B.128
C.1
D.255
šŸ’” Difficulty: hard | āœ… Correct: A

šŸ“– Explanation: Toggling PB requires Port B to be an output (so the processor can drive the pin). In Mode 0, setting D0=1 makes PB an output, while all other direction bits can remain 0 (inputs). The control word therefore is 1000 0001ā‚‚, which is 0x81. Loading this value ensures PB can be driven high or low within the interrupt service routine, while the remaining ports stay safe as inputs.

Q10. What happens if bit D7 is cleared to 0 in a control word sent to the 8255A?

A.The chip enters a low‑power sleep mode
B.The control word is ignored and the previous configuration remains unchanged āœ…
C.All ports are forced to output mode
D.Group A switches to Mode 2 automatically
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: Bit D7 is the mode‑set enable flag. When D7=0 the 8255A does not interpret the remaining bits as a new configuration; it simply retains its current settings. This means any attempt to change the mode or direction will have no effect, potentially leaving the device in an unintended state. Designers must always set D7=1 when they intend to modify the control word.

Q11. A system needs Group A in Mode 1 with Port A as input, PC upper half as output for the strobe, PC lower half as input for status, and Group B in Mode 0 with Port B as output. Which control word satisfies these requirements?

A.169 āœ…
B.153
C.161
D.185
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: Mode 1 for Group A uses D6‑D5=01, so D6=0 and D5=1. Group B stays in Mode 0 (D4=0). Direction bits: D3=1 (PC7‑4 output for the strobe), D2=0 (PC3‑0 input for status), D1=0 (Port A input), D0=1 (Port B output). Combining these yields the binary pattern 10101001ā‚‚, which equals 0xA9. Loading this value configures the 8255A exactly as described, enabling proper handshaking and output control.

šŸ”— Related Topics (MCQs)