Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Interrupts
Interrupt means requesting processor to pay
Interrupts (Contd.)
A processor can normally be interrupted by
two methods, either by an instruction or by
hardware. Accordingly the interrupts may
be classified as
Software Interrupts
Execution of an instruction causes an interrupt to
processor.
Hardware Interrupts
Application of an appropriate logic status (HIGH/LOW)
on a hardware pin of processor causes an interrupt to
processor.
Software Interrupts
8085 has an special instruction RST n
that can be used as software interrupt.
RST n means Restart (RST) execution from a
memory location addressed by the integer n.
n is an integer that can vary from 0 to 7.
Memory address given by n can be calculated as,
Address = n * 8.
E.g. RST 3 Address = 3 * 8 = 24D = 18H =
0018H. So RST 3 means restart execution from
memory location 0018H.
RST n
RST n
E.g. RST 3
Calculate address for RST 3 i.e. 0018H
(SP-1) PCH
(SP-2) PCL
SP SP 2
PC 0018H
PUSH Return
Address into
the Stack
RST n (Contd.)
Execution of RST n takes 3 Machine cycles namely,
Opcode Fetch, Memory Write and Memory Write.
Opcode Fetch takes 6 T-States, since it not only
fetches & decode the instruction, but also calculates
the address for n.
Rest of the two write cycles stores return address
into the stack so that processor can resume its
normal execution sequence.
RST n (Contd.)
It is clear that, RST 3 means Restart (RST)
execution from memory location 0018H after storing
return address in stack.
RST 3 can equivalently be said CALL 0018H.
Hence, RST n is sometimes, also called as 1-byte
CALL instruction.
RST n (Contd.)
Restart address 0018H for RST 3 is also called
Vector Address for RST 3 i.e. Interrupt Vector
Address for RST 3 is 0018H.
In the similar analogy the restart number n, in
RST n, is called Interrupt Vector.
Since both the Interrupt Vector and Interrupt
Vector Address represents same thing, the memory
address, the two terms are used synonymously.
RST n (Contd.)
A table comprising all
the vector addresses
for instruction RST n
(n=0 to 7) is called
Interrupt Vector Table
and is shown next.
Vector
RST n
(n)
Instruction
Vector
Address
RST 0
0000H
RST 1
0008H
RST 2
0010H
RST 3
0018H
RST 4
0020H
RST 5
0028H
RST 6
0030H
RST 7
0038H
Hardware Interrupts
8085
has
several
hardware
pins
be
lodged.
Below
are
list
of
Interrupts
&
Non-Vectored
Interrupts
Edge Triggered Interrupts & Level Triggered
Interrupts
Maskable
Interrupts.
Interrupts
&
Non-Maskable
Interrupt Structure
ORGANIZATION OF TRAP
Vector
RST n
(n)
Instruction
Vector
Address
RST 0
0000H
RST 1
0008H
RST 2
0010H
RST 3
0018H
RST 4
0020H
4.5
TRAP
RST 4.5
0024H
RST 5
0028H
5.5
RST 5.5
002CH
RST 6
0030H
6.5
RST 6.5
0034H
RST 7
0038H
finishes
the
currently
executing
instruction.
It stores return address in stack through stack
pointer.
It disables the INTE F/F to avoid multiple
interrupts from the same source. Programmer
should enable INTE F/F in ISS.
Interrupts Instructions
EI Enable INTE Flip-Flop i.e. Enable
Interrupt structure of 8085
E.g. EI
It applies a logic 1 on the S input of INTE F/F,
thereby, enabling interrupts.
SIM WORD
SOD SOE
RST
MSE M 7.5 M 6.5 M 5.5
7.5
SOD
OPERATION
SOD Line
Unaffected
Output 0 on
SOD Line
Output 1 on
SOD Line
A Simple Program
Write an 8085 routine to enable INTE F/F and to unmask
RST 6.5 and RST 5.5.
SIM Word
SOD SOE X
0
RST
7.5
MSE
M
7.5
M
6.5
M
5.5
1CH
RIM Word
SID
I
7.5
I
I
6.5 5.5
IE
A Simple Program
Write an 8085 routine to check if RST 5.5 is pending?
Store 0 at 2500 if it is not pending otherwise store 1.
SID
I
7.5
I
6.5
I
5.5
IE
M
7.5
M
6.5
M
5.5
RIM
10H
RST 6.5
Pin
0034H C3
0035H 00
JMP
2400H
0036H 24H
0037H
--
--
2400H
ISS
2401H
ISS at 2400H
P
M
J
Enable
Interrupts
Wait for
Interrupt
.5
6
T
RS
H
0
0
4
2
Execute ISS
0034H
Return to MAIN
SIM
EI
RST
7.5
MSE
M
7.5
M
6.5
M
5.5
1DH
; Go to ISS at 2400.
;ISS at 2400
LDA 2500
MOV B,A
LDA 2501
ADD B
STA 2502
EI
RET