Download presentation
Presentation is loading. Please wait.
1
COMPUTER PERIPHERALS AND INTERFACES
CHAPTER 1 – INTERRUPTS Interrupt is an exceptional event which causes the CPU to temporarily suspend the current program being executed . The control is transferred to some other program referred to as interrupt service routine which specifies actions to be taken if the exceptional event occurs. Interrupts are the primary means by which the input-output devices obtain the services of CPU. They greatly increase the performance of the computer by allowing the I/O devices direct and rapid access to the CPU and freeing the CPU from the task of continually testing the status of its I/O devices. Interrupts are primarily used for :- Request the CPU to initiate a new I/O operation. To signal the completion of an I/O operation. To signal the occurrence of hardware and software error.
2
How Interrupts Work? The basic method of interrupting the CPU is by activating a control line(Interrupt request IRQ) that connects the interrupt source to the CPU. The interrupt signal is then stored in a CPU register which is tested periodically by the CPU, usually at the end of every instruction cycle. On recognizing the presence of the interrupt , the CPU must execute a specific interrupt servicing program. In case of two or more interrupt requests at the same time, priorities must be assigned to the interrupts and the interrupt with the highest priority is selected. The following steps are taken when an interrupt is requested :- The CPU identifies the source of the interrupt. The CPU obtains the memory address of the required interrupt servicing program . This address may be provided by the interrupting device along with its interrupt request. The program counter and other CPU status information are saved as in a subroutine call. The program counter is loaded with the address of the interrupt servicing program.Execution proceeds until a return instruction is encountered ,which transfers control back to the interrupted program.
3
Actions executed in response of a interrupt signal
Fetch and execute next instruction Execution of an instruction completed I/O interrupt flip-flop ON? Masked? Save CPU status and registers Execute interrupt service routine Restore CPU status and registers
4
Types of interrupts 1.Hardware interrupt :-A signal created and sent to the CPU that is caused by some action taken by a hardware device. For example, keystroke depressions and mouse movements cause hardware interrupts. Examples :- 1.Reset button pressed 2.Power supply failure. 3.Power down command(screen off,hibernate,etc). 2.Software interrupt :- Also known as trap or exception. It is caused by an instruction in the program. C++: A cout or cin statement would generate a software interrupt because it would make a system call to print something. ***PCs support 256 types of software interrupts and 15 hardware interrupts.
5
3.Maskable interrupts:- There are some interrupts which can be masked out or ignored by the processor by use of a special interrupt mask bit. This mask bit is part of the flags/condition code register, or a special interrupt register. In the 8086 microprocessor if this bit is clear, and an interrupt request occurs on the Interrupt Request input, it is ignored. Examples :- A software updation message. 4.Non-maskable interrupts :-There are some interrupts which cannot be masked out or ignored by the processor. These are associated with high priority tasks which cannot be ignored . In general, most processors support the Non-Maskable Interrupt (NMI). Example :- 1.Memory parity 2.Bus faults
6
Interrupt Request(IRQ)
IRQs are hardware lines over which devices can send interrupt signals to the microprocessor. Example :- when the modem needs to run a process, it sends an interrupt request to the CPU.The CPU then interrupts its current job to let the modem run its process. There are 16 IRQs. IRQ Assignment IRQ System timer (Reserved for system timer) IRQ PS/2 port (Keyboard) IRQ Connects to IRQ 9 (not used oftenly ,can be used for modem) IRQ COM2, COM4 (second serial port) IRQ COM1, COM3 (first serial port) IRQ Sound card IRQ Floppy disk IRQ LPT1 (first parallel port i.e. for printer) IRQ Real-time clock (Reserved) IRQ can be used as network cards,PCI devices IRQ ** IRQ **
7
IRQ 12 ----------PS/2 port (mouse)
IRQ Math coprocessor /float point unit (not for peripherals) IRQ IDE primary (if there is no IDE,it can be used for other purposes) IRQ IDE secondary ** For general use.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.