Microprocessor Signals Reset Hold NMI Microprocessor INTR Hardware

  • Slides: 26
Download presentation
Microprocessor Signals

Microprocessor Signals

Reset Hold NMI Microprocessor INTR

Reset Hold NMI Microprocessor INTR

Hardware Interrupt and Arbitration

Hardware Interrupt and Arbitration

Interrupt Controller D 0 D 1 D 2 IRQ 0 IRQ 1 IRQ 2

Interrupt Controller D 0 D 1 D 2 IRQ 0 IRQ 1 IRQ 2 PIC D 7 IRQ 7 INT

Interfacing of PIC with Microprocessor

Interfacing of PIC with Microprocessor

Interval Timer KBD Controller 0 IRQ 1 1 D 0 D 1 2 COM

Interval Timer KBD Controller 0 IRQ 1 1 D 0 D 1 2 COM 2 3 COM 1 4 Other Controllers Printer Controller PIC 5 6 7 IRQ 7 D 7 INT MICRO PROCESSOR INTA

Cascading Programmable Interrupt Controller

Cascading Programmable Interrupt Controller

D 0 D 7 INTR INTA MASTER PIC cas 1 INT cas 2 cas

D 0 D 7 INTR INTA MASTER PIC cas 1 INT cas 2 cas 3 D 0 D 7 INTA IRQ 0 IRQ 2 IRQ 7 IRQ 8 PIC cas 1 INT cas 2 cas 3 SLAVE IRQ 15

Priority Level IRQ 0 = HIGHEST IRQ 15 = LOWEST

Priority Level IRQ 0 = HIGHEST IRQ 15 = LOWEST

Hardware Interrupt are Non-Preemptive

Hardware Interrupt are Non-Preemptive

If Hardware Interrupt are Preemptive E. g. KBD Interrupt C PRESSED A PRESSED B

If Hardware Interrupt are Preemptive E. g. KBD Interrupt C PRESSED A PRESSED B PRESSED Input received C B A Logically Correct Logically Incorrect ABC

So for diagram should be A PRESSED B PRESSED C PRESSED Input received A

So for diagram should be A PRESSED B PRESSED C PRESSED Input received A B C Logically Correct

Flow Diagram for Normal Interrupt INPUT/OUT PUT Operations IRET

Flow Diagram for Normal Interrupt INPUT/OUT PUT Operations IRET

Who Notifies EOI?

Who Notifies EOI?

 • No notification / Signal generated by Processor to PIC about ending of

• No notification / Signal generated by Processor to PIC about ending of Interrupt. • Responsibility of Programmer to Notify PIC about EOI. • Simply IRET is not enough for Hardware Interrupts as PIC will not be able to Issue the pending Interrupts.

Pending Interrupts

Pending Interrupts

Programming the PIC

Programming the PIC

ICW = Initialization Control Words OCW = Operation Control Words • ICW programmed at

ICW = Initialization Control Words OCW = Operation Control Words • ICW programmed at time of boot up • ICW are used to program the operation mode like cascade mode or not also it is used to program the function of PIC i. e. if it is to invoke interrupts 08~ 0 FH or 70 -77 H on IRQ request. • OCW are used at run-time. • OCW is used to signal PIC, EOI code. • OCW are also used to read/write the value of ISR, IMR, IRR

ISR IMR 7 6 5 4 0 0 0 1 7 6 5 0

ISR IMR 7 6 5 4 0 0 0 1 7 6 5 0 0 7 IRR 1 3 2 1 0 0 0 4 3 2 1 0 0 0 1 0 6 5 4 3 2 1 0 0 0 1

 • Master PIC has two ports 20 H=OCW for EOI 21 H=OCW for

• Master PIC has two ports 20 H=OCW for EOI 21 H=OCW for IMR • Slave PIC has two ports as well AOH=OCW for EOI code A 1 H=OCW for IMR

#include <dos. h> #include <stdio. h> #include <bios. h> void main() { outport(0 x

#include <dos. h> #include <stdio. h> #include <bios. h> void main() { outport(0 x 21, 0 x 02); }

#include <dos. h> #include <stdio. h> #include <bios. h> void interrupt(*oldints)(); void interrupt newint

#include <dos. h> #include <stdio. h> #include <bios. h> void interrupt(*oldints)(); void interrupt newint 8(); void main() { oldints = getvect(0 x 08); setvect(0 x 08, newint 8); keep(0, 1000); }

void interrupt newint 8() { t++; if (t==182) { outport(0 x 21, 2); }

void interrupt newint 8() { t++; if (t==182) { outport(0 x 21, 2); } else { if (t==364) { outport(0 x 21, 0); t=0; } } *oldints(); }

#include <dos. h> void interrupt(*old)(); void interrupt newint 9(); void main() { old =

#include <dos. h> void interrupt(*old)(); void interrupt newint 9(); void main() { old = getvect(0 x 09); setvect(0 x 09, newint 9); keep(0, 1000); } void interrupt newint 9() { if (inportb(0 x 60)==0 x 1 F) { outportb(0 x 20, 0 x 20); return; } (*old)(); }

#include <dos. h> void interrupt newint 9() void interrupt(*old)(); { void interrupt newint 9();

#include <dos. h> void interrupt newint 9() void interrupt(*old)(); { void interrupt newint 9(); if (inportb(0 x 60)==0 x 1 F) { int i=1; i++; void main() if (i<=5){ { outportb(0 x 20, 0 x 20); old=getvect(0 x 09); return; setvect(0 x 09, newint 9); } keep(0, 1000); i=1; } } (*old)(); }

#include <dos. h> void interrupt(*old)(); void interrupt newint 9(); char far *scr=(char far *)

#include <dos. h> void interrupt(*old)(); void interrupt newint 9(); char far *scr=(char far *) 0 x 00400017; void main() { old=getvect(0 x 09); setvect(0 x 09, newint 9); keep(0, 1000); } void interrupt newint 9() { if((inportb(0 x 60)==83)&&((*scr)&12==12)) { outportb(0 x 20, 0 x 20); return; } (*old)(); }