All 16 questions UPSC has asked on interrupts in the Electrical Engineering Optional (Paper II, Microprocessors and Microcomputers) from 2001 to 2026, solved step by step – latest first.
Try them yourself first: the same questions, without solutions, are on our Microprocessors and Microcomputers topic-wise PYQs page. Circuit diagrams have been redrawn from the question papers.
How we check these solutions
These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:
- ✓ Checked by computer the numbers were worked out again independently in code (SymPy and NumPy: circuit equations, power balance, matrices, integrals).
- ✓ Answer checked step by step for theory and descriptive questions, every point was checked against the standard theory.
Where a printed question is wrong, unclear or incomplete, we say so and solve the intended version.
Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.
Jump to a question (year · question number):
2026 · 3c 2025 · 3c 2023 · 4c 2022 · 4a 2018 · 5d(i) 2018 · 5d(ii) 2017 · 1c(i) 2017 · 5b(i) 2017 · 7b(ii) 2016 · 4b 2014 · 1b(i) 2012 · 5b 2011 · 7b(i) 2010 · 6b 2009 · 7b 2001 · 2a
What are the types of interrupts available in the 8085 microprocessor? Discuss the use of the EI and DI instructions. Give the significance of each bit of the accumulator when interpreted for the SIM and RIM instructions.
Solution
Types of interrupts in the 8085
| Interrupt | Type | Triggering | Vector |
|---|---|---|---|
| TRAP | Non-maskable, vectored | Edge and level | 0024H |
| RST 7.5 | Maskable, vectored | Rising edge (latched) | 003CH |
| RST 6.5 | Maskable, vectored | Level (high) | 0034H |
| RST 5.5 | Maskable, vectored | Level (high) | 002CH |
| INTR | Maskable, non-vectored (the device supplies RST n or CALL) | Level (high) | from the device |
There are also the software interrupts RST 0 to RST 7, which are instructions that jump to 8n (0000H, 0008H, … 0038H).
EI and DI
EIsets the interrupt-enable flip-flop. All maskable interrupts (INTR and RST 7.5, 6.5, 5.5) can then be accepted, provided they are not masked bySIM. The enable takes effect after the instruction that followsEI.DIresets the flip-flop, so all maskable interrupts are ignored.- When any interrupt is accepted, the flip-flop is reset automatically. So an interrupt service routine must execute
EIagain (usually just beforeRET) if further interrupts are to be accepted. - TRAP is not affected by
EIorDI.
Accumulator bits for SIM and RIM
SIM (the accumulator is written to the interrupt and serial control):
| Bit | Name | Meaning |
|---|---|---|
| D7 | SOD | Serial output bit |
| D6 | SDE | Serial data enable: 1 sends D7 to the SOD pin |
| D5 | × | Not used |
| D4 | R7.5 | 1 resets the RST 7.5 request flip-flop |
| D3 | MSE | Mask set enable: 1 makes D2–D0 effective |
| D2, D1, D0 | M7.5, M6.5, M5.5 | 1 masks (disables), 0 unmasks that interrupt |
RIM (the status is read into the accumulator):
| Bit | Name | Meaning |
|---|---|---|
| D7 | SID | Serial input bit |
| D6, D5, D4 | I7.5, I6.5, I5.5 | 1 means the interrupt is pending |
| D3 | IE | Interrupt-enable flag: 1 means enabled |
| D2, D1, D0 | M7.5, M6.5, M5.5 | Current mask status |
✓ Answer checked step by step Standard result (Intel 8085 data sheet).
Explain maskable interrupt. Draw the timing diagram for the maskable interrupt acknowledgement cycle. List the activities in each clock cycle.
Solution
Maskable interrupt. An interrupt that the processor can enable or disable under program control. The 8085’s maskable interrupts are INTR, RST 7.5, RST 6.5 and RST 5.5:
EIandDIenable or disable them all;SIMmasks RST 7.5, 6.5 and 5.5 individually;- after reset, and after any interrupt is accepted, they are disabled until
EIis executed.
TRAP is the only non-maskable one.
Acknowledging INTR (with RST n)
- The 8085 checks INTR during the last clock cycle of every instruction. If INTR = 1 and interrupts are enabled, it completes the current instruction and disables interrupts.
- It then runs an interrupt-acknowledge machine cycle instead of an opcode fetch.
Activities in each clock cycle
| Cycle | Activity |
|---|---|
| M1 T1 | The PC appears on the address lines (it is not used); ALE is high; IO/ = 1 and S1 S0 = 11 (INTA cycle) |
| M1 T2–T3 | goes low (instead of ). The external device places the RST n opcode (11 NNN 111) on the data bus, and it is read into the instruction register. The PC is not incremented |
| M1 T4–T6 | The opcode is decoded as a restart. SP is decremented; the restart address 8n is formed internally |
| M2 T1–T3 | Memory write: PCH goes to SP − 1 ( low in T2–T3) |
| M3 T1–T3 | Memory write: PCL goes to SP − 2. SP becomes SP − 2 |
| End | PC ← 8 × n. Execution continues at the vector address (0000H, 0008H … 0038H) |
The total is 6 + 3 + 3 = 12 T-states.
If the device supplies a 3-byte CALL, two more INTA cycles read the address bytes, and the total becomes 18 T-states.
✓ Checked by computer We checked the T-state count of the acknowledge sequence against the 8085 data sheet.
Explain four instructions which are used to control interrupt structure of 8085 microprocessor.
Solution
EI(enable interrupts). Sets the interrupt-enable flip-flop, so that INTR, RST 7.5, 6.5 and 5.5 (if unmasked) are accepted. It takes effect after the next instruction. It is needed at the start of a program and before returning from a service routine.DI(disable interrupts). Resets the flip-flop, so that all maskable interrupts are ignored. It is used to protect time-critical code. TRAP still works.SIM(set interrupt mask). Uses the accumulator to:- mask or unmask RST 7.5, 6.5 and 5.5 individually (bits D2–D0, with MSE = D3 = 1);
- reset the RST 7.5 flip-flop (D4);
- send a serial bit to SOD (D7, with SDE = D6 = 1).
Example:
MVI A, 0EHthenSIMmasks 7.5 and 6.5 and leaves 5.5 enabled.RIM(read interrupt mask). Loads the accumulator with:- the current masks (D2–D0);
- the interrupt-enable flag (D3);
- the pending interrupts (D6–D4);
- the serial input bit from SID (D7).
It is used to check which interrupts are pending or masked.
✓ Answer checked step by step Standard result.
(i) List various interrupts in microprocessor 8085 in order of decreasing priority. Specify which of these are edge-sensitive and which are level-sensitive. Explain why TRAP is having good noise immunity as compared to other interrupts. (ii) What will be the action of running the given assembly program segment? MVI A, 0B H; SIM.
Solution
(i) Interrupts in decreasing priority
| Priority | Interrupt | Sensitivity |
|---|---|---|
| 1 (highest) | TRAP | Edge and level sensitive (rising edge, then must stay high) |
| 2 | RST 7.5 | Edge sensitive (rising edge, latched in a flip-flop) |
| 3 | RST 6.5 | Level sensitive (high) |
| 4 | RST 5.5 | Level sensitive (high) |
| 5 (lowest) | INTR | Level sensitive (high) |
Why TRAP has good noise immunity. TRAP is accepted only if a rising edge occurs and the line then stays high until it is sampled. A short noise spike gives an edge but does not hold the level. A steady wrong level without a fresh edge is ignored too.
This double requirement keeps false triggering low, which matters because TRAP cannot be masked. It is used for critical events such as power failure.
(ii) MVI A, 0BH then SIM
| Bit | Value | Effect |
|---|---|---|
| D7 SOD, D6 SDE | 0, 0 | no serial output |
| D4 R7.5 | 0 | the RST 7.5 flip-flop is not reset |
| D3 MSE | 1 | the masks are applied |
| D2 M7.5 | 0 | RST 7.5 unmasked (enabled) |
| D1 M6.5 | 1 | RST 6.5 masked |
| D0 M5.5 | 1 | RST 5.5 masked |
So only RST 7.5, among the three restart interrupts, is enabled. It will actually be recognised only if the interrupt system is enabled by EI. TRAP and INTR are not affected by SIM.
✓ Checked by computer We decoded the SIM byte bit by bit in Python.
What do you mean by maskable interrupts? Which interrupt cannot be masked?
Solution
A maskable interrupt is one that the processor can ignore (mask) under program control.
- In the 8085,
DIor a reset disables all of INTR, RST 7.5, RST 6.5 and RST 5.5, andEIenables them again. - In addition,
SIMcan mask RST 7.5, 6.5 and 5.5 one by one.
While masked, a request is not serviced. RST 7.5 is the exception in one respect: its request is remembered (latched) until it is serviced or reset.
TRAP cannot be masked. It is always accepted, whatever the state of EI, DI or SIM, which is why it is used for emergencies such as power failure. It has the highest priority and vectors to 0024H.
✓ Answer checked step by step Standard result.
Write an assembly language program to enable RST 6.5 interrupt.
Solution
To enable RST 6.5 we must:
- clear its mask bit with
SIM(MSE = 1, M6.5 = 0); - enable the interrupt system with
EI.
Here we unmask only RST 6.5 and keep 7.5 and 5.5 masked:
| Instruction | Comment |
|---|---|
LXI SP, 27FFH |
stack for the return address |
MVI A, 0DH |
0000 1101: unmask 6.5 only |
SIM |
apply the mask |
EI |
enable the interrupt system |
LOOP: JMP LOOP |
main program (or other work) |
Service routine at the vector 0034H (usually a JMP to the actual routine):
| Instruction | Comment |
|---|---|
ISR65: PUSH PSW |
save the registers used |
| … | service the device |
POP PSW |
|
EI |
re-enable interrupts |
RET |
To enable all three restart interrupts, use MVI A, 08H (MSE = 1, all masks 0).
✓ Checked by computer We worked out the mask byte bit by bit in Python.
Describe the two ways in which the interrupt RST 7.5 in 8085 micro-processor can be disabled.
Solution
RST 7.5 can be disabled in two ways.
- By masking it with
SIM. Load the accumulator with D3 (MSE) = 1 and D2 (M7.5) = 1, then executeSIM. For example,MVI A, 0CHthenSIMmasks only RST 7.5. Its request can still be latched in the RST 7.5 flip-flop, and it will be serviced later, when it is unmasked. Setting D4 (R7.5) = 1 in the sameSIMbyte (for example 1CH) also clears any pending request. - By disabling the whole interrupt system with
DI(or by a reset, or automatically on accepting any interrupt). The interrupt-enable flip-flop is reset, so RST 7.5, together with RST 6.5, RST 5.5 and INTR, is not recognised untilEIis executed.
The difference: SIM disables RST 7.5 selectively and leaves the others; DI disables all the maskable interrupts at once.
✓ Answer checked step by step Standard result.
How long can the INTR pulse stay high in 8085 microprocessor?
Solution
INTR is level-sensitive and is not latched inside the 8085. So the pulse must satisfy two conditions.
- Minimum: it must stay high until it is acknowledged. The 8085 samples INTR only in the last clock cycle of an instruction. So INTR must remain high long enough to be seen at the end of the current instruction, which can be up to 18 T-states (
CALL): 6 µs at 3 MHz. In practice the device keeps INTR high until it receives . - Maximum: it must go low before interrupts are enabled again. Accepting INTR automatically disables interrupts, but if INTR is still high when the service routine executes
EI, the same request is accepted again and the routine re-enters itself. So INTR must be removed after and before theEIin the service routine (in practice, as soon as the INTA cycle is over).
In short, INTR may stay high from the request until it is acknowledged, and no longer than the execution of EI in the service routine.
✓ Answer checked step by step Standard result.
Suppose that an 8085 microprocessor has received three interrupt requests in the following order: RST 7.5, RST 6.5 and RST 5.5. If these three interrupts are nested, to what depth does the stack penetrate if all registers within the CPU must be saved? Assume that the stack pointer initially points to location FFFFH.
Solution
For each interrupt, the 8085 pushes the return address (2 bytes) automatically. To save all registers, the service routine executes PUSH PSW, PUSH B, PUSH D and PUSH H (8 bytes).
With three interrupts nested (each service routine re-enables interrupts with EI and is interrupted by the next):
| Event | SP after |
|---|---|
| Start | FFFFH |
| RST 7.5 accepted + 4 PUSH | FFFFH − 10 = FFF5H |
| RST 6.5 accepted + 4 PUSH | FFEBH |
| RST 5.5 accepted + 4 PUSH | FFE1H |
The stack penetrates 30 bytes deep, occupying FFFEH down to FFE1H. SP ends at FFE1H.
Note. Because 7.5 > 6.5 > 5.5 in priority, this nesting happens only if each service routine executes EI early and leaves the lower interrupts unmasked. The 8085 itself has no rule against a lower-priority interrupt interrupting a higher-priority service routine once interrupts are re-enabled.
✓ Checked by computer We traced the stack pointer through the three nested interrupts in Python.
Write down the purpose of each bit in SIM (Set Interrupt Mark) instruction. Give three different functions of SIM instruction.
Solution
Purpose of each bit of the accumulator for SIM
| Bit | Name | Purpose |
|---|---|---|
| D0 | M5.5 | Mask for RST 5.5 (1 = masked) |
| D1 | M6.5 | Mask for RST 6.5 |
| D2 | M7.5 | Mask for RST 7.5 |
| D3 | MSE | Mask set enable: D0–D2 are used only if MSE = 1 |
| D4 | R7.5 | 1 resets the RST 7.5 flip-flop (clears a pending 7.5 request) |
| D5 | – | Not used |
| D6 | SDE | Serial data enable: D7 is sent out only if SDE = 1 |
| D7 | SOD | Serial output data bit, sent to the SOD pin |
Three functions of SIM
- Set or clear the masks of RST 7.5, 6.5 and 5.5 individually. For example,
MVI A, 08HthenSIMunmasks all three. - Reset the RST 7.5 flip-flop, which cancels a pending 7.5 request. For example,
MVI A, 10HthenSIM. - Serial output. Send one bit at a time to the SOD pin. For example,
MVI A, C0HthenSIMoutputs a 1. This is used for software serial transmission.
(The question’s “Set Interrupt Mark” means Set Interrupt Mask.)
✓ Answer checked step by step Standard result.
Write the various interrupts available in the microprocessor 8085 in the order of decreasing priority.
Solution
In order of decreasing priority:
- TRAP: non-maskable; edge and level triggered; vector 0024H.
- RST 7.5: maskable; rising edge (latched); 003CH.
- RST 6.5: maskable; level; 0034H.
- RST 5.5: maskable; level; 002CH.
- INTR: maskable; level; non-vectored. The vector comes from the device (RST n or CALL), and it is acknowledged by .
The software interrupts RST 0–RST 7 are instructions, so they have no priority level.
✓ Answer checked step by step Standard result.
Can the 8085 microprocessor be interrupted before completion of existing Interrupt Service Subroutine (ISS)? Justify your answer.
Solution
Yes, it can, if the program allows it.
When the 8085 accepts an interrupt, it automatically resets the interrupt-enable flip-flop. So, by default, no other maskable interrupt can break into the service routine.
However:
- TRAP is non-maskable. It is always accepted, even in the middle of any service routine. So the routine can always be interrupted by TRAP.
- Re-enabling. If the routine executes
EIbefore it finishes (for example, near the start), the maskable interrupts (RST 7.5, 6.5, 5.5 and INTR, if unmasked bySIM) are accepted again. A new request then suspends the current routine: its return address is pushed onto the stack, and the new routine runs. This is nested interrupts. The original routine resumes after the inner one returns. - RST 7.5 requests are latched, so a 7.5 request that arrives while interrupts are disabled is not lost. It is serviced as soon as interrupts are enabled again.
The 8085 has no hardware that blocks a lower-priority interrupt from interrupting a higher-priority routine once EI is executed. The programmer controls this with SIM masks, for example by masking the lower levels inside a high-priority routine.
So the routine can be interrupted by TRAP always, and by maskable interrupts if it re-enables them with EI. If it does not, the new requests wait (RST 7.5 latched; INTR and 6.5/5.5 only if still held high) until EI is executed before RET.
✓ Answer checked step by step Standard result.
This question has the following parts.
(i) What are the features of three sources of interrupts that 8086 has?
(ii) What are the three operations possible in the ‘string’ group? What are the registers used by the instructions in this group?
(iii) Write the block diagram indicating how 8255A PPI is interfaced to 8086 max mode CPU module, using two 8255As for 16-bit I/O operation.
Solution
(i) Three sources of interrupts in the 8086
- Hardware, external.
- NMI: non-maskable, rising-edge triggered, type 2 (vector at 00008H).
- INTR: maskable through the IF flag (
STI,CLI), level triggered. It is acknowledged by two pulses, and the device (usually an 8259A) supplies an 8-bit type number. The vector address is 4 × type.
- Software. The instruction
INT n(n = 0–255) calls any of the 256 vectors;INT 3is a 1-byte breakpoint andINTOis interrupt on overflow (type 4). These let programs call system services. - Internal (processor-generated exceptions).
- Type 0: divide error.
- Type 1: single-step, when TF = 1.
- Type 4: overflow (with
INTO).
All of them use the same interrupt vector table at 00000H–003FFH: 4 bytes (IP, CS) per type. On entry, the CPU pushes the flags, CS and IP, and clears IF and TF.
(ii) String group
Operations:
- move (
MOVS); - compare (
CMPS), scan (SCAS); - load (
LODS) and store (STOS), with the prefixREP,REPE,REPNE.
These are usually summed up as three operations: move/copy, compare/scan (search), and load/store.
- move (
Registers used:
- SI, the source offset, in the DS segment;
- DI, the destination offset, in the ES segment;
- CX, the count for the
REPprefixes; - AL/AX, the data for
SCAS,LODSandSTOS.
Direction: the DF flag sets the direction.
CLDmakes SI and DI auto-increment;STDmakes them auto-decrement (by 1 for bytes, 2 for words).
(iii) Two 8255As for 16-bit I/O on an 8086 maximum-mode CPU module
- In maximum mode, the 8288 bus controller decodes S2–S0 into the command signals and . These drive and of both 8255As.
- Addresses are latched by 74LS373s using ALE, and data passes through 8286 transceivers (DT/, DEN).
- One 8255A sits on the low data byte D7–D0 and is selected when A0 = 0. The other sits on the high byte D15–D8 and is selected when = 0.
- Address lines A1 and A2 select the port or control register in each chip (A0 is used for the byte selection), and the higher address lines go to the decoder for .
- A 16-bit
IN AX, portorOUT port, AXat an even address enables both chips together, giving 16-bit ports: for example port A of both chips as one 16-bit port.
✓ Answer checked step by step Standard result.
The interrupt is a process of data transfer whereby a peripheral can inform the processor that it is ready for communication. How can interrupt be masked or unmasked using a program control? List the instructions used for control of interrupts. Explain any one by taking a suitable example.
Solution
Masking and unmasking by program. Interrupts are controlled at two levels.
All the maskable interrupts together, through the interrupt-enable flip-flop:
EIenables INTR, RST 7.5, 6.5 and 5.5;DIdisables them all.
The flip-flop is also reset on reset and whenever an interrupt is accepted.
RST 7.5, 6.5 and 5.5 individually, through the mask bits set by
SIM: 1 = masked, 0 = unmasked, with MSE = 1.
TRAP cannot be masked at all. INTR has no individual mask: only EI and DI control it.
Instructions for controlling interrupts: EI, DI, SIM, RIM, together with RST n (the software interrupts) and RET (return from the service routine).
Example: SIM. We want RST 5.5 enabled, RST 6.5 and 7.5 masked, and a pending 7.5 request cleared:
- D4 R7.5 = 1: reset the 7.5 flip-flop.
- D3 MSE = 1.
- D2 = 1: mask 7.5.
- D1 = 1: mask 6.5.
- D0 = 0: unmask 5.5.
| Instruction | Comment |
|---|---|
MVI A, 1EH |
mask pattern |
SIM |
apply the masks, clear the 7.5 request |
EI |
enable the interrupt system |
Afterwards, RIM would show D2 D1 D0 = 110 and IE = 1. A high level on RST 5.5 then causes a jump to 002CH at the end of the current instruction.
✓ Answer checked step by step Standard result.
An 8085 processor based interrupt system requires handling of 11 interrupting devices, excluding TRAP interrupt. Show schematically how this can be achieved. Indicate any one interrupt vector address.
Solution
The 8085 has four maskable hardware inputs: RST 7.5, RST 6.5, RST 5.5 and INTR.
- Three devices are connected directly to RST 7.5, 6.5 and 5.5. These are vectored, and their priority is fixed.
- The remaining eight devices share INTR. A priority encoder (74LS148, or an 8259A PIC) does three jobs:
- it raises INTR whenever any of them requests;
- it encodes the highest-priority request as a 3-bit number AAA;
- when comes, it places the 1-byte opcode RST AAA = 11 AAA 111 on the data bus through a tri-state buffer.
The total is 3 + 8 = 11 devices.
Vector addresses
| Source | Vector |
|---|---|
| RST 7.5 | 003CH |
| RST 6.5 | 0034H |
| RST 5.5 | 002CH |
| INTR → RST n | 8n: 0000H, 0008H, … 0038H |
One vector worked out. A device on encoder input 5 produces RST 5 (opcode EFH = 11 101 111). The processor pushes the PC and jumps to 0028H, where a JMP to that device’s service routine is stored.
(RST 0 at 0000H is the reset address, so a practical design avoids using it; an 8259A, which supplies a full CALL address, removes this limit.)
✓ Checked by computer We counted the inputs and worked out the vector addresses in Python.
What is the fundamental difference between a subroutine call and an interrupt request? Is it possible to employ a common memory stack for both?
Solution
Fundamental difference. A subroutine call is a planned, synchronous transfer: the CALL instruction is written in the program, at a known point, and the programmer knows when it happens. An interrupt request is an external, asynchronous event. It comes from a device at an unpredictable time, between any two instructions, and the processor answers it (if enabled) by itself calling a service routine.
| Subroutine call | Interrupt |
|---|---|
| Started by an instruction in the program | Started by a hardware signal (or RST, INT) |
| Occurs at a known place | Occurs at any time (asynchronous) |
| Target address in the instruction | Target from a fixed vector or supplied by the device |
| Cannot be disabled | Maskable ones can be enabled or disabled (EI, DI, SIM) |
| No acknowledge cycle | Acknowledge cycle () for INTR; interrupts disabled on entry |
| Registers are saved as the program needs | The service routine must save every register it uses, because the interrupted program did not expect the break |
Can a common stack be used? Yes. Both save the return address with the same mechanism: the PC is pushed at SP − 1 and SP − 2. Both return with RET (in the 8086, IRET for interrupts). So one stack in R/W memory serves both, and calls and interrupts can be nested in any order, because they unwind last-in, first-out.
The stack must be large enough for the deepest combination: nested subroutines plus nested interrupts with all their saved registers. Every service routine must also leave it balanced (equal PUSH and POP before RET).
✓ Answer checked step by step Standard result.
More on Microprocessors and Microcomputers
- All Electrical Engineering PYQ solutions, topic by topic
- Microprocessors and Microcomputers topic-wise PYQs (questions only, for practice)
- Electrical Engineering PYQ analysis: which units carry the marks year by year
- Year-wise question papers
- Electrical Engineering booklist
Questions: UPSC Civil Services (Main) Examination, Electrical Engineering Paper II, 2001–2026. Solutions: Optional Province. Found an error? Tell us.

