Interrupt
Interrupt
1 Introduction
The interrupt allows the processor to
execute programs when an I/O device
needs attention, it asserts an interrupt signal
which is an input to the CPU.
Interrupt
- RST 5
It is a maskable interrupt. When this interrupt is
executed, the processor saves the content of the
PC register into the stack and branches to 002CH
address.
- INTR
It is a maskable interrupt, having the lowest
priority among all interrupts. It can be disabled by
resetting the microprocessor.
When INTR signal goes high, the following
events can occur −
The microprocessor checks the status of INTR
signal during the execution of each instruction.
When the INTR signal is high, then the
microprocessor completes its current instruction
and sends active low interrupt acknowledge
signal.
- Software Interrupt
In software interrupts,
The cause of the interrupt is an execution of the
instruction. These are special instructions
supported by the microprocessor. After execution
of these instructions’ microprocessor completes
the execution of the instruction it is currently
executing and transfers the program control to the
subroutine program. Upon completion of the
execution of the subroutine program, program
control returns to the main program.
The 8085 has eight software interrupts from RST
0 to RST 7. The vector address for these interrupts
can be calculated as follows. Interrupt number x
8 = vector address
- Masking / Unmasking of Interrupts:
As mentioned earlier, maskable interrupts are
enabled and disabled under program control. In
this section we will see how interrupts can be
masked or unmasked using program control.
There are four instructions used for control of
interrupts:
EI enable interrupt
DI disable interrupt
RIM reset interrupt mask
SIM set interrupt mask
address of the next instruction on stack and
executes the received instruction. Two types of
Software Interrupt:
- Unconditional branch. Go to a new location
no matter what.
- Conditional branch.
Go to a new location if the condition is true.
- Call, Return, and Restart
These instructions change the sequence of a
program either by calling a subroutine or
returning from a subroutine. The conditional Call
and Return instructions also can test condition
flags.
Unconditional Branch
JMP Address Jump to the address specified (Go
to).
CALL Address. Jump to the address specified but
treat it as a subroutine.
RET. Return from a subroutine. The addresses
supplied to all branch operations must be 16-bits.
8.3.3 Subroutines
A subroutine is a group of instructions that will be
used repeatedly in different locations of the
program.
• Rather than repeat the same instructions several
times, they can be grouped into a subroutine that
is called from the different locations. The 8085
has two instructions for dealing with subroutines.
– The CALL instruction is used to redirect
program execution to the subroutine.
• The RTE instruction is used to return the
execution to the calling routine.
• CALL 4000H
8.3.4 Conditional Branch
Go to new location if a specified condition is met.
JZ Address (Jump on Zero)
Go to address specified if the Zero flag is set.
JNZ Address (Jump on NOT Zero)
• Go to address specified if the Zero flag is not
set.
• JC Address (Jump on Carry)
• Go to the address specified if the Carry flag is
set.
• JNC Address (Jump on No Carry)
• Go to the address specified if the Carry flag is
not set. • JP Address (Jump on Plus)
• Go to the address specified if the Sign flag is
not set • JM Address (Jump on Minus)
• Go to the address specified if the Sign flag is
set.
8.6 Machine Control
HLT
• Stop executing the program.
• NOP
• No operation
• #Exactly as it says, do nothing. Usually used for
delay or to replace instructions during debugging.
Exercise 8
1- Define the interrupt of 8085 Microprocessor
2- Mention the types of the interrupts in 8085
Microprocessor.
3- Explain the types of the Hardware interrupts
and its priority.
4- Compare between the Hardware and soft ware
interrupts from point of views: 1- Types
2- Instructions
3- Operation
5- Explain with instructions how the interrupts are
enable and disable.
6- Explain the conditional branch instructions.