šŸŽ“ BookMCQ
← Back to 10. Programmable Keyboard and Display Interface: 8279

šŸ“ Programming of 8279 (8 MCQs)

Software Commands for Keyboard and Display Configuration

Programming the 8279 involves writing command words to configure keyboard scanning, display operation, clock division, memory access and interrupt handling. It provides eight principal commands selected through the upper three bits of a command byte. The processor sends commands with A0 high and accesses ordinary data with A0 low, using the device's read and write control signals.

Eight Command Groups and Their Functions

The eight commands are Keyboard/Display Mode Set, Program Clock, Read FIFO/Sensor RAM, Read Display RAM, Write Display RAM, Display Write Inhibit/Blanking, Clear and End Interrupt/Error Mode Set. Their first three bits range from 000 to 111, identifying the required operation. The remaining bits provide configuration, address and control information.

Command Writing and Data Transfer Sequence

The processor selects the 8279 through CS, places the command byte on DB0–DB7 and activates WR while A0 is high. After configuration, display or input data is transferred with A0 low. Read operations use RD, with A0 determining whether the processor reads data or status information.

Example of Initializing the 8279 and Writing Display Data

Assume command port C2H and data port C0H. Execute MVI A,00H; OUT C2H to select eight-digit left entry with encoded two-key lockout. Then use MVI A,90H; OUT C2H to select display RAM address 0 with auto-increment, followed by MVI A,88H; OUT C0H to write a character pattern.

Programming Relationship with FIFO and Display RAM

Keyboard commands configure how key information is stored and retrieved, while display commands select display RAM addresses and writing behaviour. Clock programming determines scan and debounce timing. Status and interrupt commands allow software to identify pending input, FIFO conditions and sensor events, making command selection central to effective peripheral operation.

Misconceptions About 8279 Command Programming

'A0 equal to zero writes command words' reverses the command/data selection because commands use A0 high. 'The control register stores display characters' confuses command storage with display RAM. 'Every 8279 command has the same lower five bits' is incorrect because each command defines its own fields and functions.

Command Identification and Assembly Programming Questions

Memorize the eight command groups and identify each through its upper three bits. Practise constructing keyboard/display control words, selecting RAM addresses and programming clock division. Understand A0, CS, RD and WR during command and data transfers, and trace a complete initialization sequence.

8279 Command and Programming Terminology

  • Command Word - Configures a particular device operation.
  • A0 - Distinguishes command and data accesses.
  • Keyboard Mode Set - Selects keyboard and display modes.
  • Program Clock - Sets the internal timing division.
  • Read FIFO - Selects keyboard data reading.
  • Write Display RAM - Selects display memory writing.
3
Easy
3
Medium
2
Hard

šŸ“ All Programming of 8279 MCQs

Q1. A microcontroller must generate a periodic interrupt using counter 0 of the 8253. Which pin provides the output signal that can be connected to the interrupt line?

A.OUT 0 (pin 10) āœ…
B.GATE 0 (pin 11)
C.CLK 0 (pin 9)
D.CS (pin 21)
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: The OUT 0 pin (pin 10) carries the counter’s output pulse, which can be wired to an interrupt input on the microcontroller, making it the correct choice. GATE 0 merely enables counting and does not produce an external pulse, so it cannot trigger an interrupt. CLK 0 is an internal timing source, not an output. CS is used for device selection, not for generating interrupts. Using the proper output pin ensures reliable interrupt generation in real hardware.

Q2. To load a new count value into counter 2 while the system is operating, which combination of control signals must be asserted according to the 8253 control‑signal table?

A.CS=0, RD=1, WR=0, A1=1, A0=0 āœ…
B.CS=0, RD=0, WR=1, A1=1, A0=0
C.CS=1, RD=1, WR=0, A1=0, A0=1
D.CS=0, RD=1, WR=1, A1=1, A0=1
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: The table shows that loading counter 2 requires CS low, RD high, WR low, with address lines A1=1 and A0=0, matching option A. Option B has RD low and WR high, which corresponds to a read operation, not a load. Option C sets CS high, disabling the chip, so no load occurs. Option D asserts WR high, which prevents the write cycle. Correct signal sequencing guarantees the new count is correctly captured while the system runs.

Q3. During a DMA setup, the CPU needs to write a mode word to configure counter 1 as a rate generator. Which pins are involved in this operation and what must be the state of the WR line?

A.CS low, WR low, A1=0, A0=1 āœ…
B.CS low, WR high, A1=0, A0=1
C.CS high, WR low, A1=1, A0=0
D.CS low, WR low, A1=1, A0=1
šŸ’” Difficulty: hard | āœ… Correct: A

šŸ“– Explanation: Writing a mode word requires the chip‑select (CS) and write (WR) signals to be asserted low, with the address lines set to select counter 1 (A1=0, A0=1). Option A satisfies all these conditions. Option B keeps WR high, which would prevent any write. Option C disables the chip by setting CS high, so no data is accepted. Option D selects the wrong counter (counter 2) while still writing a mode word, leading to an unintended configuration. Proper pin control ensures the correct mode is programmed.

Q4. If pin 21 (CS) is connected to an active‑low enable circuit but is left floating (high‑impedance) during operation, what is the most likely effect on the 8253 device?

A.The device will operate normally because CS defaults to high.
B.The device will be permanently enabled.
C.The device may enter an undefined state, leading to unpredictable behavior. āœ…
D.The device will be permanently disabled.
šŸ’” Difficulty: medium | āœ… Correct: C

šŸ“– Explanation: When CS is floating, its voltage is undefined, so the chip cannot reliably determine whether it should be enabled or disabled, resulting in unpredictable behavior (option C). Assuming a default high (option A) is unsafe because the pin is not tied to a defined level. Permanent enable (option B) or permanent disable (option D) would require CS to be firmly driven low or high, which is not the case with a floating line. In real designs, leaving control pins unconnected can cause intermittent failures.

Q5. What primary function does the GATE input serve for each counter in the 8253 timer chip?

A.It provides the clock signal to the counter.
B.It enables or disables counting based on the gate level. āœ…
C.It resets the counter to zero.
D.It selects the counter for read/write operations.
šŸ’” Difficulty: easy | āœ… Correct: B

šŸ“– Explanation: The GATE input controls whether the counter is allowed to count; a high level typically enables counting while a low level pauses it, making option B correct. Option A describes the clock input, not the gate. Option C would be a reset function, which is handled by other pins. Option D refers to address selection, which involves A0/A1 and CS, not the gate. Understanding the gate’s role helps designers pause timers without losing the current count.

Q6. How do the address lines A0 and A1 influence which counter or register is accessed in the 8253?

A.They determine the operating mode of the selected counter.
B.They select one of the three counters or the control word register for reading or writing. āœ…
C.They provide power supply levels to the chip.
D.They are used only for debugging purposes.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: A0 and A1 act as address selectors: the combination 00 selects counter 0, 01 selects counter 1, 10 selects counter 2, and 11 selects the control word register, which matches option B. Option A confuses address selection with mode selection, which is set via the mode word. Option C is unrelated to addressing, and option D is incorrect because the lines are essential for normal operation, not just debugging. Proper addressing ensures the correct component of the timer is programmed.

Q7. Why does the 8253 require both the CS (chip‑select) and WR (write) signals to be low when writing a mode word, rather than relying on WR alone?

A.To allow the device to differentiate between a mode‑word write and a counter‑value write.
B.To ensure that only the intended device on a shared bus is addressed, preventing accidental writes to other peripherals. āœ…
C.To synchronize the write operation with the internal clock of the chip.
D.To automatically reset all counters after a mode word is written.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: CS low indicates that the 8253 is the intended target on a potentially shared bus, while WR low initiates the actual write; together they prevent other devices from being unintentionally programmed, making option B correct. Option A is partly true but does not explain the need for CS in a multi‑device environment. Option C incorrectly suggests clock synchronization, which is handled separately. Option D is false because writing a mode word does not reset counters. In real systems, both signals are essential for safe and accurate bus transactions.

Q8. Which pin number on the 8253 corresponds to the clock input for counter 1?

A.10
B.14
C.15 āœ…
D.18
šŸ’” Difficulty: easy | āœ… Correct: C

šŸ“– Explanation: The clock input for counter 1 is pin 15, as defined in the pinout table, so option C is correct. Pin 10 is OUT 0, pin 14 is GATE 1, and pin 18 is CLK 2 for counter 2. Knowing the exact pin numbers is critical when wiring the timer to ensure that the correct clock source drives the intended counter.

šŸ”— Related Topics (MCQs)