š 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.
š 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?
š 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?
š 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?
š 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?
š 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?
š 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?
š 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?
š 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?
š 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.