Microprocessors - IV Interruptions: Yashar Hajiyev
Microprocessors - IV Interruptions: Yashar Hajiyev
Interruptions
Yashar Hajiyev
Microprocessor Structural Organization
(architecture)
Interruptions
Interruptions
The interrupt sequence in Intel 8080 may be illustrated as follows:
Interrupt vector is the location from where the program proceeds with
execution of interrupt servicing program;
Interrupt Request
Interrupt request
INTERRUPT SYSTEM
When interrupt request arrives, microcontroller executes the current instruction and
then stops the regular program execution. As a result, the current program memory
address is automatically pushed onto the stack and the default address
(predefined by the manufacturer) is written to the program counter.
The location from where the program proceeds with execution is called
interrupt vector.
For the PIC16F887 microcontroller, this address is 0004h. As seen in figure below,
the location containing the interrupt vector is passed over during regular program
execution.
interrupt routine.
Its 1st instruction is located at interrupt vector.
I
The location from where the program proceeds with execution is called
interrupt vector.
Finally, when the interrupt source is recognized and the interrupt routine
is executed, the microcontroller reaches the RETFIE instruction,
pops the address from the stack and proceeds with program execution from where it
left off.
Interrupt flip-flop Instructions
Interrupt Instructions
Interrupt flip-flop Instructions
Interrupting device supplies instruction (normally RST (reset) instruction),
1-byte call to one of 8 eight-byte subroutines → located in
first 64 words of memory.
Each I/O device class (e.g., floppy disks, hard disks, timers,
terminals) associated with location (near bottom of memory)
of interrupt vector.
This section describes the RST (restart) instruction, which is a special purpose
subroutine jump. This instruction occupies one byte.
TRAP highest
RST 7.5
RST 6.5
RST 5.5
INTR lowest
Thus, an RST5.5 interrupt can Interrupt the service routine for an RST7.5
interrupt.
♦ Interrupt Vector → is a location near the bottom of memory associated with
each I/O device class (floppy disks, hard disks, timers, terminals).
All interrupts starts → by saving registers, often in process table entry for current
process – it can be restarted later.
Then information pushed earlier onto stack by interrupt, is removed and the stack
pointer is set to point to a temporary stack used by the process handler
Each I/O device class (e.g., floppy disks, hard disks, timers, terminals) associated
with location (near bottom of memory) of interrupt vector.
4 types of operands Addresses; Numbers ( Integer or fixed point; floating point; Decimal );
Floating point;
Instruction Format
Instruction Format three-bytes instructions
Sample programs1
Write an assembly program to add Write an assembly program to
two numbers Program multiply a number by 8 program
► MVI D, 8Bh move data to D-reg ► MVI A, 30H move data to A-reg
► MVI C, 6Fh move data to C-reg ► RRC shift of (A) content to right with carry
► RRC shift of (A) content to right with carry
► MOV A, C move data from C-reg to A-reg
► RRC shift of (A) content to right with carry
► ADD D sum up (A) with (D)
► OUT PORT1
► OUT PORT1 content of (A) to Port 1 ► HLT
► HLT stop MP
.
Sample programs2
Write an assembly program to find greatest between
two numbers.
Program
► MVI B, 30h move data to B-reg;
► MVI C, 40h move data to C-reg;
► MOV A, B move data from B-reg to A-reg;
► CMP C compare content of A-reg with C-req;
► JZ EQU jump if equal (A)=(C) ;
► JC GRT jump if carry;
► OUT PORT1 move content of A-reg to Port 1;
► HLT stop microprocessor;
.
Registers
54
Functioning of Interrupt-Driven Input/Output (I/O)
55
Configuration of system of Interrupt-Driven
Input/Output (I/O)
Two design issues for Interrupt driven I/O module 1.How does processor deterermine
which device issued interrupt;
2. If multiple Interruption signals → how decide which to proceed?
Multiple interrupt lines between MP and I/O; in practice each line several
attached I/O modules.
Software poll (time consuming) determine which I/O module causes
interrupt
MP raises TESTI/O command and places address code of device on address
bus. I/O contains addressable status register. Positive signal comes to MP
from active I/O. MP reads status signal and branches to device specific
service program;
60
Interrupt-Driven Input/Output (I/O)
TRAP▬highest
RST7.5
RST6.5
RST5.5
INTR ▬ lowest
61
Interrupt-Driven Input/Output (I/O)
62
Interrupt-Driven Input/Output (I/O)
63
Interrupt-Driven Input/Output (I/O)
64
Interrupt-Driven Input/Output (I/O)
65
Interrupt-Driven Input/Output (I/O)
66
Interrupt-Driven Input/Output (I/O)
67
Interrupt-Driven Input/Output (I/O)
68
General Definition