📝 Operation Command Words (OCWs) of 8259 (21 MCQs)
Operating Control After the Initialization Sequence
Operation Command Words configure and control the 8259A while it is running. Unlike ICWs, which establish the initial system arrangement, OCWs can be written after initialization to change interrupt masks, control priority rotation, issue End of Interrupt commands, enable special mask mode, select polling and choose internal registers for status reading. The three words are OCW1, OCW2 and OCW3.
OCW1 and Individual Interrupt Mask Control
OCW1 is written with A0 = 1 and directly updates the eight-bit Interrupt Mask Register. Bits M0–M7 correspond to IR0–IR7 respectively. A bit value of one masks its request channel, while zero leaves that channel enabled. This permits software to disable selected peripheral requests without changing the configuration of other interrupt inputs.
OCW2 for End of Interrupt and Priority Rotation
OCW2 is selected with A0 = 0 and contains the R, SL and EOI control bits, together with L2–L0 for selecting a particular interrupt level. Its combinations support non-specific and specific EOI commands, rotation after service, automatic rotation and explicit priority assignment. The selected command determines whether the controller clears an ISR bit or changes its priority arrangement.
OCW3 for Special Masking, Polling and Status Selection
OCW3 is also written with A0 = 0. Its ESMM and SMM bits control special mask mode, while P selects the polling operation. RR and RIS select the status register to be read when a read-register command is issued. The command therefore allows software to inspect internal interrupt states or alter how requests are handled.
Example of Masking All Requests Except IR2
To enable only IR2, the software writes FBH to the OCW1 port. In binary, FBH is 11111011, so M2 is zero and every other mask bit is one. The controller can therefore accept IR2 while suppressing IR0, IR1 and IR3–IR7, subject to its programmed priority and service conditions.
Separating the Functions of the Three OCWs
'OCW1 changes the priority order' is incorrect because it controls request masking. 'OCW2 selects the IRR or ISR for reading' is incorrect because that selection belongs to OCW3. 'OCW3 writes the individual mask bits' is incorrect because the IMR is loaded through OCW1 at A0 = 1.
OCW Formats and Command Interpretation for Examinations
Associate OCW1 with A0 = 1 and the eight mask bits, and associate OCW2 and OCW3 with A0 = 0. Practise decoding the R, SL and EOI combinations in OCW2. For OCW3, distinguish ESMM/SMM, polling bit P and the RR/RIS status-selection fields.
Operating Command and Masking Terms
- OCW1 - Writes the interrupt mask register.
- OCW2 - Controls EOI and priority rotation.
- OCW3 - Controls polling and status selection.
- EOI - Marks completion of interrupt service.
- R - Controls priority rotation commands.
- SL - Selects specific-level command operation.
- IMR - Stores individual interrupt mask bits.
📝 All Operation Command Words (OCWs) of 8259 MCQs
Q1. Which pin provides the Clock input for counter 0?
📖 Explanation: The clock signal that drives counter 0 is brought in on pin 9, labelled CLK 0. Pin 10 carries the counter’s output, and pins 11 and 12 are the gate and ground respectively. Selecting pin 9 ensures the counter receives timing pulses. The other pins cannot serve as a clock source, so they are incorrect choices. This matches the hardware pin‑out used in real timer circuits.
Q2. What is the active level of the Chip Select (CS) signal?
📖 Explanation: The CS line on the 8253 is an active‑low enable. When the pin is driven low, the chip listens to other control signals; a high level disables the device. This convention is common for peripheral chips, allowing multiple devices to share a bus. The other options describe signals that are not used for CS, making them wrong.
Q3. Why must the address lines A0 and A1 be connected to the address bus when using the 8253?
📖 Explanation: A0 and A1 form a two‑bit address that selects either counter 0, counter 1, counter 2, or the control word register. By wiring them to the CPU’s address bus, the processor can address the desired internal block. Power, reset, and interrupt functions are handled by different pins, so those answers are inaccurate.
Q4. How does asserting the WR signal low influence the 8253's behavior?
📖 Explanation: When WR is driven low, the device interprets the bus data as a write operation—either loading a counter or writing a mode word. A low on RD would start a read, while disabling counters requires CS high, and resetting the mode word is not performed by WR alone. Therefore only the write description fits the hardware specification.
Q5. A CPU needs to load counter 1 while leaving counter 0 unchanged. Which control‑signal combination should be used?
📖 Explanation: The table of control‑signal actions shows that CS = 0, RD = 1, WR = 0, A1 = 0, A0 = 1 selects the “Load counter 1” operation. The other combinations either address counter 0, counter 2, or do not correspond to a load command, so they would not achieve the desired effect.
Q6. To read the current count of counter 2, which control‑signal settings are required?
📖 Explanation: According to the action table, the pattern CS = 0, RD = 0, WR = 1 with A1 = 1 and A0 = 0 commands a “Read counter 2” operation. The first option addresses counter 0, the third mixes read and write signals, and the fourth would load a counter rather than read it. Hence the second line is the correct choice.
Q7. What is the primary purpose of the Gate input terminals for each counter?
📖 Explanation: The gate input controls whether the counter is allowed to count. When the gate is asserted (typically high), the counter responds to clock pulses; when low, counting is inhibited. Clock signals arrive on the CLK pins, not the gate pins, and resetting or selecting counters uses different pins, making those alternatives incorrect.
Q8. With CS low, WR low, and address lines A1=1, A0=1, which operation is performed?
📖 Explanation: The combination CS = 0, WR = 0, and A1 = 1, A0 = 1 matches the table entry for “Write Mode Word”. This command writes a new mode word into the control register rather than loading a specific counter. The load‑counter entries require RD = 1, and the no‑operation case occurs when both RD and WR are low together, which is not the case here.
Q9. If CS, RD, and WR are all driven low simultaneously, what is the resulting behavior of the 8253?
📖 Explanation: When all three control lines are low, the device enters a three‑state condition where it ignores any bus activity; this is defined as “No operation”. Loading or reading a counter requires either RD or WR to be high, and writing a mode word needs WR low with RD high. Therefore the only consistent description is the 3‑state no‑operation mode.
Q10. How does the Gate input affect the counting process of a counter in the 8253?
📖 Explanation: The gate line acts as an enable for counting: the counter only advances on clock edges when the gate is asserted. It does not generate clock pulses (that is the CLK pin), nor does it set the mode word or carry the output. Understanding this role is essential when designing cascaded or gated timer circuits.
Q11. To cascade counter 0’s output to serve as the gate for counter 1, which pins must be connected together?
📖 Explanation: Counter 0’s output appears on pin 10 (OUT 0). Counter 1’s gate input is pin 14 (GATE 1). Connecting pin 10 to pin 14 creates a cascade where the output of counter 0 controls the counting of counter 1. The other pairings either link unrelated pins or reverse the direction, so they would not produce the intended gating effect.
Q12. Which pin number corresponds to the output terminal of counter 2?
📖 Explanation: The pin‑out table lists Pin 17 as OUT 2, the output line for counter 2. Pin 16 is the gate input, Pin 18 is the clock input, and Pin 19 is used for address selection (A0). Knowing the exact pin assignment is necessary when wiring the timer chip in a hardware project.
Q13. Why is the RD signal defined as active low in the 8253 interface?
📖 Explanation: When RD is driven low, the 8253 places the requested data (such as a counter value) on the data bus, signalling a read operation. An active‑low convention simplifies interfacing with many microprocessors that also use low‑active control lines. The other options describe functions that are not associated with the RD pin.
Q14. When CS is low, WR is low, and A1=1, A0=1, the processor writes a mode word. To which internal register is this mode word written?
📖 Explanation: The combination CS = 0, WR = 0, A1 = 1, A0 = 1 is defined as “Write Mode Word”, which targets the control word register rather than any individual counter. This register holds the mode configuration that applies to the selected counter. Therefore the correct destination is the control word register, not the counter registers themselves.
Q15. Which control signal can be used to temporarily disable all three counters without altering their stored counts?
📖 Explanation: Driving CS high disables the entire 8253 because CS is an active‑low enable. The counters retain their current counts, but no further operations are recognised until CS returns low. Changing RD or WR affects only read/write cycles, and toggling address lines does not affect enable status, so CS is the appropriate signal for a temporary global disable.
Q16. The signal combination CS=0, RD=0, WR=1, A1=0, A0=0 results in which specific operation?
📖 Explanation: With CS low and RD low while WR is high, the table indicates a “Read counter 0” action when A1 and A0 are both zero. Loading a counter requires RD high, writing a mode word needs WR low, and no‑operation occurs when both RD and WR are low together. Hence the described combination uniquely triggers a read of counter 0.
Q17. If pin 21 (CS) is permanently tied to ground, what is the implication for the 8253's operation?
📖 Explanation: CS being active‑low means that a constant low level keeps the chip enabled at all times. The device will respond to any subsequent RD, WR, or address signals. It is not disabled, nor does it lose the ability to write; address lines remain functional because CS does not block them when low.
Q18. How does the combination CS=0, RD=1, WR=0, A1=1, A0=0 affect counter 2?
📖 Explanation: The table shows that CS = 0, RD = 1, WR = 0 with A1 = 1 and A0 = 0 selects the “Load counter 2” operation. The other options correspond to different address settings or control‑signal states, making them unsuitable for loading counter 2.
Q19. In a system where the CPU needs to read counter 1, which of the following control‑signal settings is appropriate?
📖 Explanation: Reading counter 1 requires CS low, RD low, WR high, and the address bits set to select counter 1 (A1=0, A0=1). The first option matches this pattern. The second option would load counter 1, the third reads counter 2, and the fourth attempts a load operation, so they are incorrect.
Q20. What role does the +VCC pin (pin 24) play in the operation of the 8253 timer chip?
📖 Explanation: Pin 24 supplies the +5 V required for the internal circuitry of the 8253, including the three counters and the control logic. It does not serve as a reference for logic thresholds (that is the ground pin), nor does it generate clocks or act as a ground. Supplying power is essential for the chip to function.
Q21. When configuring the 8253 for a square‑wave output on counter 0, which mode word bits must be set, and which pins are involved in providing the clock and output?
📖 Explanation: A square‑wave requires mode 3, where bits 6‑4 of the mode word are set to 011. The clock source is supplied on pin 9 (CLK 0) and the generated square‑wave appears on pin 10 (OUT 0). The other options list incorrect modes or use pins that belong to other counters, so they do not produce the desired square‑wave output.