📝 Rotating Priority Mode of 8259A (8 MCQs)
Changing the Default Priority Order Through Rotation
Rotating Priority Mode changes the fixed priority arrangement of the 8259A so that a device does not always remain at the same rank. After a selected interrupt has been serviced, it can be moved to the lowest-priority position. The remaining request levels shift accordingly, allowing devices of comparable importance to receive more balanced opportunities for service.
Automatic Rotation After an Interrupt Service Completion
The controller supports rotation through OCW2 commands. Rotation on non-specific EOI combines service completion with moving the serviced level to the lowest priority. Automatic rotation can also be enabled so that priority changes whenever an interrupt is completed under AEOI. These functions avoid requiring software to assign a new priority order after every service event.
Specific Priority Assignment Using the OCW2 Level Bits
Software can also select a particular interrupt level to become the lowest-priority request. The R and SL bits in OCW2 identify the set-priority command, while L2–L0 specify the selected level. Once that level is assigned the bottom position, the other seven request levels follow it in circular priority order.
Example of Priority Rotation After Servicing IR4
Initially, IR0 has the highest priority and IR7 the lowest. If IR4 is serviced and rotation on non-specific EOI is used, IR4 moves to the bottom. IR5 becomes highest, followed by IR6, IR7, IR0, IR1, IR2 and IR3, with IR4 now last. A later request from IR5 therefore receives priority over the other levels.
Fairer Access for Devices with Similar Service Requirements
Rotating priority is useful when several peripheral devices need regular service and a permanently higher-ranked device could otherwise dominate the controller. Rotation limits the period that a request must wait behind other devices under sustained activity. It does not remove request masking or service tracking, and the selected rotation command determines exactly when the priority order changes.
Misunderstandings About How Priority Rotation Works
'Rotation changes the order of IR input pins physically' is incorrect because it changes the controller's logical priority assignment. 'Every request rotates priority as soon as it arrives' is incorrect because rotation is controlled by OCW2 or automatic EOI operation. 'IR4 always remains fourth in priority' is incorrect because rotation can move it to the lowest position.
OCW2 Bit Combinations and Priority Sequences for Examinations
Distinguish rotation on non-specific EOI, automatic rotation and specific priority assignment. Remember that R, SL and EOI determine the OCW2 operation, while L2–L0 identify a level when required. Practise rewriting the complete priority order after a specified level becomes lowest and compare the result with the original IR0-to-IR7 arrangement.
Priority Rotation and OCW2 Terms
- Rotation - Circular change in interrupt priority.
- OCW2 - Command word for priority and EOI operations.
- R - Selects a rotation-related operation.
- SL - Selects a specific interrupt level.
- EOI - Completes an interrupt service level.
- Bottom Priority - Lowest position in the priority order.
📝 All Rotating Priority Mode of 8259A MCQs
Q1. A designer connects the CLK0 pin to a 1 kHz square‑wave source and programs counter 0 for mode 2 (rate generator). Which pin will present the divided frequency output?
📖 Explanation: The OUT0 pin delivers the timer’s output, so the divided frequency appears there. GATE0 only enables or disables counting, CLK0 is the input clock itself, and CS is a chip‑select control that does not carry the timer signal. In real circuits the OUT pin is wired to the next stage, such as a prescaler, making it the correct choice for observing the divided frequency.
Q2. What function does the CS (Chip Select) signal serve in the 8253 timer chip?
📖 Explanation: CS is an active‑low enable; when it is low the 8253 responds to bus operations, otherwise it ignores them. Selecting a counter is done with the address lines A0/A1, not CS. The clock signal comes from the CLK pins, and CS does not disable the chip when low—it enables it. Understanding CS is essential when integrating the timer into a system that may share the bus with other peripherals.
Q3. If A0=0, A1=1 and the WR line is driven low while the CPU supplies data, what operation does the 8253 perform?
📖 Explanation: When A0=0 and A1=1 the address selects counter 1. A low WR indicates a write cycle, so the data placed on the bus is loaded into counter 1’s count register. Writing a mode word requires A0=A1=1, which is not the case here, and a read operation would need RD low instead of WR. This scenario mirrors typical programming of a specific counter in an embedded system.
Q4. Why are the RD and WR inputs of the 8253 active‑low rather than active‑high?
📖 Explanation: TTL families historically use active‑low control signals, so the 8253 follows that convention for compatibility with other TTL devices. Reducing power or avoiding noise are secondary effects, not the primary design reason. Simplifying timing is a benefit but not the driving factor. Recognizing the logic level convention helps engineers correctly interface the timer with microprocessors that also use active‑low control lines.
Q5. In rotating priority mode, only one gate input can be high at a time. If GATE1 is high and GATE0 and GATE2 are low, which counter will generate an output pulse on its OUT pin?
📖 Explanation: Rotating priority grants the clock to the first counter whose gate is high according to the current priority position. With only GATE1 asserted, counter 1 receives the clock and toggles its OUT pin. Counter 0 and counter 2 see low gate inputs, so they remain idle. This behavior is used in designs where a single shared clock must be handed to different timers based on external enable signals.
Q6. Which pin number on the 8253 package corresponds to the OUT2 terminal?
📖 Explanation: The OUT2 terminal is assigned to pin 17 on the 8253 IC package. Pin 16 carries GATE2, pin 18 is CLK2, and pin 19 is the address line A0. Confusing the pin numbers can lead to wiring errors that prevent a counter from functioning, especially in hardware where precise pin‑to‑function mapping is critical for reliable operation.
Q7. How does rotating priority mode decide which counter receives the clock when several gate inputs are simultaneously active?
📖 Explanation: Rotating priority maintains an internal priority pointer that moves to the next counter after a grant, ensuring each active gate gets a turn in a round‑robin fashion. The scheme does not simply pick the lowest number nor does it change every clock tick; it follows a deterministic rotation. This mechanism is valuable in multitasking hardware where fairness among timers is required.
Q8. A microcontroller writes a mode word to set counter 0 to mode 3 (square‑wave) and then loads a count of 20. If the clock input is a 2 MHz signal, what is the frequency observed on OUT0?
📖 Explanation: In mode 3 the output toggles once every full count, so the output frequency equals the input frequency divided by twice the count: . The other options result from incorrect division factors. Knowing this relationship lets engineers design precise square‑wave generators for applications such as tone generation or timing pulses.