Pratidin
2026 · Electrical Engineering Optional Paper II · 10 marksMainsQuestion 4bi

Write an assembly language program for the 8253/8254 (programmable interval timer) to operate in mode 3 and mode 2.
Use counter 0 for which control word register address is 2DH and counter 0 address is 2BH. Input clock is 1 MHz and output frequency is 1 kHz.

10 marks · directive: Write

Answer

The core of a good answer

The count is 1 MHz/1 kHz = 1000 = 03E8H; the control word for counter 0, LSB then MSB, binary count is 36H for mode 3 (square wave) and 34H for mode 2 (rate generator), written to 2DH, followed by E8H and 03H written to 2BH.

An outline written by upsc.help, not an official UPSC answer; every fact checked by a separate review. How we work

What the question asks

The candidate must compute the count, build the 8253 control word bit by bit for each mode, and write 8085 OUT instructions in the correct order (control word first, then low byte and high byte of the count).

Answer outline

Introduction

8253 control word format: D7 D6 = SC1 SC0 (counter select), D5 D4 = RW1 RW0, D3 to D1 = M2 M1 M0 (mode), D0 = BCD. Count N = fclk/fout = 10⁶/10³ = 1000 = 03E8H (binary).

Step 1: Control words

Step 2: Program for mode 3 (1 kHz square wave)

Step 3: Program for mode 2 (1 kHz rate generator)

Step 4: Output waveforms

Conclusion

Count 03E8H with control word 36H (mode 3) or 34H (mode 2) gives a 1 kHz output from counter 0 with a 1 MHz clock.

Examples and data to cite

Facts

Facts to remember

Sources used for the explanation

Write a timed answer in the app