📝 Control Word Format of 8253 (10 MCQs)
Eight-Bit Control Word Structure and Field Arrangement
The 8253 control word is an eight-bit configuration value written to its control register to select a counter and determine its operating characteristics. Its fields are SC1–SC0 for counter selection, RW1–RW0 for count reading and loading, M2–M0 for operating mode and BCD for counting format. These fields determine how the selected counter receives and processes its initial value.
Counter Selection and Read Write Format Bits
SC1SC0 equal to 00 selects Counter 0, 01 selects Counter 1 and 10 selects Counter 2; 11 is unused in the 8253. RW1RW0 equal to 01 selects LSB only, 10 selects MSB only and 11 selects LSB followed by MSB. The value 00 issues a counter-latch command.
Mode Selection and Binary or BCD Counting
Bits M2–M0 select Modes 0 through 5, with 110 and 111 acting as aliases for Modes 2 and 3 respectively. D0 selects counting format: zero represents binary counting and one represents BCD counting. Binary operation supports a maximum count of 65,536, while BCD supports a maximum decimal count of 10,000.
Example of Constructing a Mode 2 Control Word
To select Counter 0, LSB/MSB loading, Mode 2 and binary counting, combine 00, 11, 010 and 0. The resulting binary control word is 00110100B, equivalent to 34H. Writing 34H to the control register prepares Counter 0 for the subsequent initial-count transfers.
Counter Latching and Reading the Current Count
RW1RW0 equal to 00 commands the selected counter to latch its current count without stopping its counting operation. The processor can subsequently read the preserved value through the data bus. For a sixteen-bit read/write format, the programmed byte sequence determines how low and high bytes are transferred.
Misconceptions About 8253 Control Word Fields
'SC1SC0 equal to 11 selects Counter 3' is incorrect because the 8253 contains only three counters and this selection is unused. 'RW equal to 00 loads zero' is incorrect because it requests count latching. 'D0 selects the operating mode' is incorrect because it determines binary or BCD counting.
Binary Control Word Construction Examination Questions
Practise identifying all eight control-word bits and converting binary values into hexadecimal. Construct control words for each counter and operating mode, and distinguish LSB-only, MSB-only and LSB/MSB formats. Questions may also involve counter-latch commands, invalid counter selection or the difference between binary and BCD counting limits.
Control Register and Counter Configuration Terminology
- SC - Selects the counter channel.
- RW - Determines count transfer format.
- M2–M0 - Selects operating mode.
- BCD - Selects decimal-coded counting.
- LSB - Least significant count byte.
- MSB - Most significant count byte.
📝 All Control Word Format of 8253 MCQs
Q1. What is the size of the control word that must be written to the 8253 timer?
📖 Explanation: The 8253 requires a single byte (8 bits) for its control word because each field—counter select, read/load, mode, and BCD/binary—fits within one byte. A 16‑bit word would be unnecessary and would not match the chip’s register layout. Likewise, 24‑ and 32‑bit sizes are far larger than needed and would never be accepted by the hardware.
Q2. Which field in the control word is responsible for selecting which counter (0, 1, or 2) is being programmed?
📖 Explanation: The two most‑significant bits of the control word identify the counter: 00 for counter 0, 01 for counter 1, and 10 for counter 2. Mode bits choose the operating mode, the BCD/Binary bit chooses counting base, and the Read/Load bits control how the count value is accessed. Selecting the correct counter is essential for independent timer operation.
Q3. A designer wants a 1 kHz square‑wave output from counter 0. Which mode bits should be set in the control word?
📖 Explanation: Mode 2, the rate generator, produces a periodic output that can be divided by two to obtain a 1 kHz square wave when the appropriate count is loaded. Mode 0 only generates a single pulse, Mode 3 creates a square wave directly but with a different duty cycle, and Mode 5 is for hardware‑triggered counting, none of which suit the 1 kHz requirement.
Q4. How does the BCD/Binary select bit affect the counting operation of an 8253 counter?
📖 Explanation: When the BCD/Binary bit is 0, the counter counts in pure binary; when it is 1, the counter counts in packed BCD, meaning each four‑bit nibble represents a decimal digit. This choice does not change the clock source, gate behavior, or mode selection, but it directly influences how the loaded count value is interpreted and how overflow is detected.
Q5. With a 1.19318 MHz clock, what 16‑bit value must be loaded into counter 1 (binary mode, mode 0) to obtain a 10 ms delay?
📖 Explanation: The required count equals clock × delay: decimal, which is 0x2E44 in hexadecimal. Loading this value causes the counter to decrement from 11932 to zero, taking exactly 10 ms. The other options are off by several hundred counts, producing noticeably longer or shorter delays, which would be unacceptable for precise timing.
Q6. Why does the control word contain separate Read/Load bits for LSB and MSB?
📖 Explanation: Separate Read/Load bits let the processor first write (or read) the least‑significant byte and then the most‑significant byte, matching the 8‑bit data bus of many microprocessors. This sequential approach simplifies hardware design and avoids the need for a 16‑bit bus. DMA, mode selection, and counter selection are handled by other fields in the control word.
Q7. If the control word is 0b00110101, which combination of fields does it represent?
📖 Explanation: Bits 7‑6 = 00 select counter 0; bits 5‑4 = 11 indicate a LSB‑then‑MSB read/write operation; bits 3‑1 = 010 encode mode 2 (rate generator); bit 0 = 1 selects BCD counting. This decoding shows how each part of the byte maps to a specific function, enabling precise configuration of the timer. The other options misinterpret one or more fields, leading to incorrect operation.
Q8. Which hexadecimal control word should be written to configure counter 2 for mode 3 (square‑wave), binary counting, with a LSB‑then‑MSB load sequence?
📖 Explanation: Counter 2 is identified by bits 7‑6 = 10 (0x80). A LSB‑then‑MSB load uses bits 5‑4 = 11 (0x30). Mode 3 is encoded as 011 in bits 3‑1 (0x06). The BCD bit is 0 for binary counting. Adding the components gives 0x80 + 0x30 + 0x06 = 0xB6. The other hexadecimal values change one or more fields, resulting in a different counter, mode, or counting base.
Q9. What is the primary purpose of the gate input on each 8253 counter?
📖 Explanation: The gate input acts as an enable signal: when asserted, the counter receives clock pulses and begins counting; when de‑asserted, counting pauses while the current count is held. It does not change the mode, supply power, or reset the counter—those functions are controlled by other pins. Proper gating is crucial when timers must be synchronized with external events.
Q10. A system with a 500 kHz clock needs an interrupt every 5 ms using counter 0 in binary mode. Which value should be loaded into the counter?
📖 Explanation: The required count is clock × interval: decimal, which converts to 0x09C4 in hexadecimal. Loading this value makes the counter roll over after exactly 5 ms, generating the interrupt. The other options correspond to counts that are either too large or too small, producing longer or shorter interrupt periods that would not meet the timing requirement.