Class 8
Class 8
•It is a process where an external device can get the attention of the microprocess
•The process starts from the I/O device.
•The process is asynchronous.
Classification of Interrupts
Interrupts can be classified into two types based on masking:
Maskable Interrupts (Can be delayed or Rejected)
Non-Maskable Interrupts (Can not be delayed or Rejected)
• There are two ways of redirecting the execution to the ISR depending on
whether the interrupt is vectored or non-vectored.
Non Vectored: The device will have to supply the address of the
subroutine to the Microprocessor
8085 Interrupts
• The ‘EI’ instruction is a one byte instruction and is used to Enable the
non-maskable interrupts.
• The ‘DI’ instruction is a one byte instruction and is used to Disable the
non-maskable interrupts.
RST 5.5, RST 6.5, RST 7.5 are all automatically vectored.
RST 5.5, RST 6.5, and RST 7.5 are all maskable.
• The purpose of the IVT is to hold the vectors that redirect the
microprocessor to the right place when an interrupt arrives.
Interrupts in 8085 microprocessor
The MPU may receive a signal from any peripheral(s) requesting its
services - this signal is named interrupt signal
• They are – INTR, RST 7.5, RST 6.5, RST 5.5, TRAP
• Software Interrupts are those which are inserted in between the program thru
mnemonics of microprocessor.
• Vectored Interrupts are those which have fixed vector address (starting address of sub-
routine) on interrupt and after executing these, program control is transferred to the
main program.
INTR, RST 7.5, RST 6.5, RST 5.5 are maskable interrupts in 8085
TRAP
It is a non-maskable interrupt, having the highest priority among all
interrupts. By default, it is enabled until it gets acknowledged. In case of
failure, it executes as ISR and sends the data to backup memory. This
interrupt transfers the control to the location 0024H.
RST7.5
It is a maskable interrupt, having the second highest priority among all
interrupts. When this interrupt is executed, the processor saves the
content of the PC register into the stack and branches to 003CH address.
RST 6.5
It is a maskable interrupt, having the third highest priority among all
interrupts. When this interrupt is executed, the processor saves the content
of the PC register into the stack and branches to 0034H address.
RST 5.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.
Instruction for Interrupts
EI – This interrupt enable flip-flop once set, all interrupts following the EI instruction
are enabled.
No flags are affected.
After a system reset, the interrupt enable flip-flop is reset, thus disabling
the interrupts.
This instruction is necessary to enable the interrupts again
(except TRAP).
MPU goes to 003C location and will get a JMP instruction to the actual
ISR address.
2.The 8085 checks for an interrupt during the execution of every instruction.
3.If INTR is high, MPU completes current instruction, disables the interrupt
and sends INTA (Interrupt acknowledge) signal to the device that
interrupted
4.INTA allows the I/O device to send a RST instruction through data bus.
5.Upon receiving the INTA signal, MPU saves the memory location of the
next instruction on the stack and the program is transferred to ‘call’ location
(ISR Call) specified by the RST instruction
6.MPU Performs the ISR.
7.ISR must include the ‘EI’ instruction to enable the further interrupt within
the program.
8.RET instruction at the end of the ISR allows the MPU to retrieve the return
address from the stack and the program is transferred back to where the
program was interrupted.
First the required value is loaded in accumulator then SIM will take the bit
pattern from it.
Read Interrupt Mask (RIM) – This instruction is used to read the status of the
hardware interrupts (RST 7.5, RST 6.5, RST 5.5) by loading into the A register a
byte which defines the condition of the mask bits for the interrupts.
It also reads the condition of SID (Serial Input Data) bit on the microprocessor.
Write a main program to count continuously in binary with 1 second delay b
each count
Write a ISR at XX70H to flash FFH five times when the program is interrupte
some appropriate delay between each flash
MAIN PROGRAM
Memory
Label Mnemonics
address
XX00 LXI SP, XX99H
03 EI
04 MVI A, 00H
06 NXTCNT : OUT Port 1
08 MVI C, 01H
0A CALL DELAY
0D INR A
0E JMP NXTXNT
Assume that interrupt (RST 5) occurs at XX06H
RST 5 is at - 0020H
At 0020H JMP XX70H
XX83 POP B
XX84 EI
XX85 RET
Multiple interrupts and Priorities
There are 8 different RST Instructions .
•How do MPU allow multiple devices to interrupt using the INTR line?
•The microprocessor can only respond to one signal on INTR at a time.
•Therefore, we must allow the signal from only one of the devices to reach the
microprocessor.
We must assign some priority to the different devices and allow their signals to
reach the microprocessor according to the priority.
The solution is to use a circuit called the priority encoder as opcodes for the
different RST instructions follow a set pattern.
When microprocessor receives multiple interrupt requests simultaneously, it
will execute the interrupt service request (ISR) according to the priority of the
interrupt.
Assuming the MP is completing an RST 7.5 interrupt request, check to see if RST 6.5
is pending. If it is pending, enable RST 6.5 without affecting any other interrupts
otherwise, return to the main program
Label Mnemonics
RIM
MOV B,A
JNZ NEXT
EI
RET
NEXT :
MOV A,B
ANI 0DH
ORI 08H
SIM
JMP SERV// JMP To ISR of 6.5
Issues in Implementing INTR Interrupts
How long must INTR remain high?
The microprocessor checks the INTR line one clock cycle before the
last T-state of each instruction.
The INTR must remain active long enough to allow for the longest
instruction.
The longest instruction for the 8085 is the conditional CALL instruction
which requires 18 T-states.
The data transfer can be either in two forms namely parallel or serial
respectively.