Interrupts and Interrupts Service Routine
Interrupts and Interrupts Service Routine
1.68
Table 1.2. Procedures Vs
Macros
icrocontrola
PROCEDURES MACROS
s.No.
To use a procedure CALL and RET To use a macro, Just type its na
instructions are needed name
2. It occupies less memory. It occupies more memory.
3. Stack is used. Stack is not used.
To mark the end of the procedure, type To mark the end of the macro EN
the name of the procedure before the| directive is enough. NDN
ENDP directive.
Overhead time is required to call the| No overhead time during
procedure and return to the calling| execution the
program.
that points
atthe interrupt service routine in memory. Generally, interrupts referred
ress
eir index into this table, so interrupt zero's address (vector) is at memory location U0,
their s vector is at address 0:4, interrupt two's vector is at address 0:8, etc.
rupt o n e ' s v e
rent interrupt
service routine. When an interrupt occurs, the CPU branches to the address
rhe table that corresponds to the interrupt's number.
3FFH TYPE 255 POINTER:
AVAILABLE 3FC H (AVAILABLE)
INTERRUPT
TYPE 33 POINTER:
084 H
(AVAILABLE)
TYPE 32 POINTER:
080 H
(AVAILABLE)
TYPE 31 POINTER:
RESERVED 07FH
(AVAILABLE)
INTERRUPT
TYPE 5 POINTER:
014 H
(RESERVED)
TYPE 4 POINTER:
010 H OVERFLOW
TYPE 3 POINTER:
DEDICATED 00 1-BYTE INT INSTRUCTION
INTERRUPT TYPE 2 POINTER:
008 H NON MASKABLE
TYPE 1 POINTER:
004 H SINGLE STEP
TYPE O POINTER:
000 H
DIVIDE ERROR
Vector Table
Fig. 1.18. Interrupt
does the following:
When an interrupt occurs, regardless of source, the 8086
stack.
T h e CPU pushes the flags register onto the
(segment:offset) onto the stack, segment
T h e CPU pushes a far return address
value first.
the interrupt number) and
3. The CPU determines the cause of the interrupt (i.e., 0:8 etc)
fetches the four byte interrupt vector
from address 0: vector x 4 (0:0, 0:4,
the interrupt vector table
4. The CPU transfers control to the routine specified by
entry.
1.70
After the completion of these steps, the interrupt service routine takes control. wh
Microcontrollery
Microprocessors and Microcontron
Progammable
NMI Requesting Interrupt Controller
Device
IRo
NMI -IR,
8086 CPU INTR Intel -IR2
Interrupt Logic 8259A -IR
IR
IR,
INTO Error Step
INTINTovideSingle IR
Software Traps -IR
Fig. 1.19. 8086 Interrupt Connections
1.71
iv) Breakpoint Interrupt (Type 3)
This interrupt is used to set break
points in software debugging programns.
()Overflow Interrupt (Type 4)
This interrupt is initiated by INTO (Interrupt on Overflow) instruction. It is used to
herk overflow condition after any signed arithmetic operation in the system. The overflow
che
aa (OF) will be set if the signed arithmetic operation generates a result whose size is larger
han the size of destination register or memory location. At this time overflow interrupt is
indicate an error condition.
used to
1.13.5 Software Interrupts (INT n)
The software interrupts are non maskable interrupts. They are higher priority than
hardware interrupts.
The software interrupts are called within the program using the instruction INT n.
Here 'n'means value and is in the range of 0 to 255. These interrupts are useful for debugging,
testing ISRs and calling procedures.
Interrupt Priority
INT n, INTO, Divide Error Highest
NMI
INTR