25
Systems Design & Programming Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C UN IV E R S IT Y O F M A R Y L A N D B A L T I M O R E C O U N T Y 1 9 6 6 Interrupts Interrupt processing is an alternative to polling. The Intel microprocessors support hardware interrupts through: • Two pins that allow interrupt requests, INTR and NMI • One pin that acknowledges, INT A, the interrupt requested on INTR. And software interrupts through instructions: • INT, INTO, INT 3, BOUND Control is provided through • IF and TF flag bits • IRET and IRETD Time Executing task on the Microprocessor Main program Keyboard ISR Printer ISR

CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

1(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Inte

rrup

tsIn

terr

upt p

roce

ssin

g is

an

alte

rnat

ive

to p

ollin

g.

The

Inte

l mic

ropr

oces

sors

sup

port

har

dwar

e in

terr

upts

thro

ugh:

• Tw

o pi

ns th

at a

llow

inte

rrup

t req

uest

s, IN

TR a

nd N

MI

• O

ne p

in th

at a

ckno

wle

dges

,IN

TA, t

he in

terr

upt r

eque

sted

on

INTR

.

And

sof

twar

e in

terr

upts

thro

ugh

inst

ruct

ions

:•

INT,

INTO

, IN

T 3,

BO

UN

D

Con

trol

is p

rovi

ded

thro

ugh

• IF

and

TF

flag

bits

• IR

ET a

nd IR

ETD

Tim

e

Exec

utin

g ta

sk o

n th

e M

icro

proc

esso

rM

ain

prog

ram

Key

boar

d IS

RPr

inte

r IS

R

Page 2: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

2(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Inte

rrup

t V

ecto

r Ta

ble

INT

and

INT3

beh

ave

in a

sim

ilar

way

.IN

T n: Cal

ls IS

R lo

cate

d at

vec

tor

n (n

*4).

The

INT

inst

ruct

ion

requ

ires

two

byte

s of

mem

ory,

opc

ode

plus

n.

BOU

ND

and

INTO

are

bot

h co

ndit

iona

l.BO

UN

D:

AX

is c

ompa

red

wit

h D

ATA

and

DA

TA+1

, if l

ess

than

an

inte

rrup

toc

curs

.A

X is

com

pare

d w

ith

DA

TA+2

and

DA

TA+3

, if g

reat

er th

an a

n in

ter-

rupt

occ

urs.

INTO

:C

heck

s th

e ov

erflo

w fl

ag (O

F). I

f OF=

1, th

e IS

R is

cal

led.

IRET

rem

oves

6 b

ytes

from

the

stac

k, 2

for

IP, 2

for

CS

and

2 fo

r FL

AG

S.

BOUNDAX, DATA

;Compares AX with DATA

Page 3: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

3(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Inte

rrup

t V

ecto

r Ta

ble

Div

ide

erro

rSi

ngle

-ste

pN

MI

pin

1-by

te b

reak

poin

tO

verfl

ow (I

NT

O)

Bou

ndU

ndefi

ned

Opc

ode

Cop

roce

ssor

not

ava

ilD

oubl

e fa

ult

Cop

roc

seg

over

run

Inva

lid

task

sta

te s

egSe

gmen

t not

pre

sent

Stac

k se

g ov

erru

nG

ener

al p

rote

ctio

nPa

ge f

ault

Una

ssig

ned

Cop

roce

ssor

err

or

000H

004H

008H

00CH

010H

014H

018H

01CH

020H

024H

028H

02CH

030H

034H

038H

03CH

040H

14-3

1 R

eser

ved

32-2

55 U

ser

defin

ed080H

Seg

high

Seg

low

Off

set h

igh

Off

set l

owBy

te 3

Byte

2By

te 1

Byte

0

The

inte

rrup

t vec

tor

tabl

e is

loca

ted

inth

e fir

st 1

024

byte

s of

mem

ory

atad

dres

ses

0000

00H

thro

ugh

0003

FFH

.

Ther

e ar

e 25

6 4-

byte

ent

ries

(seg

men

tan

d of

fset

in r

eal m

ode)

.

012345678910111213141516

Page 4: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

4(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Rea

l Mod

e In

terr

upts

Aft

er th

e ex

ecut

ion

of e

ach

inst

ruct

ion,

the

mic

ropr

oces

sor

dete

rmin

esw

heth

er a

n in

terr

upt i

s ac

tive

by

chec

king

, in

orde

r: O

ther

inst

ruct

ion

exec

utio

ns S

ingl

e-st

ep N

MI

Cop

roce

ssor

seg

men

t ove

rrun

INT

R IN

T

If o

ne o

r m

ore

of th

ese

cond

itio

ns a

re p

rese

nt, t

hen:

FLA

GS

is p

ushe

d on

to th

e st

ack

Bot

h th

e in

terr

upt (

IF) a

nd tr

ap (T

F) fla

gs a

re

clea

red,

whi

ch d

isab

les

the

INTR

pin

and

the

trap

or

sing

le-s

tep

feat

ure.

The

CS

and

IP a

re p

ushe

d on

to th

e st

ack.

The

inte

rrup

t vec

tor

cont

ents

are

fetc

hed

and

load

ed in

to C

S an

d IP

and

exec

utio

n re

sum

es in

the

ISR

. O

n IR

ET, C

S, IP

and

FLA

GS

are

popp

ed.

IF a

nd T

F ar

e se

t to

the

stat

e pr

ior

to th

e in

terr

upt.

Page 5: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

5(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Rea

l and

Pro

tect

ed M

ode

Inte

rrup

tsTh

e re

turn

add

ress

(CS/

IP) i

s pu

shed

ont

o th

e st

ack

duri

ng th

e in

terr

upt.

The

retu

rn a

ddre

ss c

an p

oint

to:

The

nex

t ins

truc

tion

. T

he o

ffen

ding

(cur

rent

) ins

truc

tion

.Th

e la

tter

cas

e oc

curs

for

inte

rrup

ts 0

, 5, 6

, 7, 8

, 10,

11,

12

and

13.

This

mak

es it

pos

sibl

e to

try

the

inst

ruct

ion

agai

n.

Prot

ecte

d M

ode:

The

sam

e in

terr

upt a

ssig

nmen

ts a

re m

ade

and

the

sam

e se

quen

ce o

f ope

ra-

tion

s oc

curs

in p

rote

cted

mod

e bu

t the

inte

rrup

t tab

le is

diff

eren

t.

Inst

ead,

256

inte

rrup

t des

crip

tors

are

use

d in

the

inte

rrup

t des

crip

tor

tabl

e(I

DT)

.

Off

set (

A31

-A16

)P

DPL

0111

000

H

01

23

45

67

Segm

ent

Sele

ctor

Off

set (

A15

-A0)

Pres

ent

Page 6: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

6(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Har

dwar

e In

terr

upts

The

INTR

pin

mus

t be

exte

rnal

ly d

ecod

ed to

sel

ect a

vec

tor.

Any

vec

tor

is p

ossi

ble,

but

the

inte

rrup

t vec

tors

bet

wee

n 20

H a

nd F

FHar

e us

ually

use

d (I

ntel

res

erve

s ve

ctor

s be

twee

n 00

H a

nd 1

FH).

INTA

is a

n ou

tput

of t

he m

icro

proc

esso

r to

sig

nal t

he e

xter

nal d

ecod

er to

plac

e th

e in

terr

upt n

umbe

r on

dat

a bu

s co

nnec

tion

s D

7-D

0.

The

INTR

pin

is s

et b

y an

ext

erna

l dev

ice

(825

9A) a

nd c

lear

ed in

the

ISR

.Th

e in

put i

s au

tom

atic

ally

dis

able

d by

the

mic

ropr

oces

sor

once

it is

rec

-og

nize

d an

d re

-ena

bled

by

IRET

or

IRET

D in

stru

ctio

n.Ti

min

g di

agra

m o

f the

han

dsha

ke.

INTR

LOC

K

INTA

D7-

D0

Vect

or n

umbe

r

Page 7: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

7(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Har

dwar

e In

terr

upts

Sim

plie

st m

etho

d of

gen

erat

ing

an in

terr

upt v

ecto

r:

D0

D1

D6

D5

D4

D3

D2

D7

VC

C

INTA

no c

onne

ctio

n

Low

dat

abu

s

27K

Alw

ays

gene

rate

s in

terr

upt

vect

or F

FH in

res

pons

eto

INTR

.

Page 8: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

8(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Tri

-sta

te B

uffe

r fo

r G

ener

atin

g th

e In

terr

upt

Vec

tor

D0

D1

D6

D5

D4

D3

D2

D7

INTA

Low

dat

abu

s VC

C

74A

LS24

4Y

1...

A1

...G

G

App

lies

inte

rrup

tve

ctor

80H

inre

spon

se to

INTA

.

Page 9: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

9(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

An

Exa

mpl

e 82

C55

Int

erru

pt C

onfig

urat

ion

STB

D0

D7

Key

boar

d

DA

V

ASC

II

82C

55D

0

D7

A0

A7

B7

B0

C7

C0

CS

D7

-- D

0

8

IOR

C

Wai

t2

RD

WR

A0

A1

Res

et

A0

A1

Res

et

16L8

A3

A4

A5

A7

A8

A6

A9

A10

I 1 I 10

O1

O8

A0

IOW

C

A11

A13

A14

A12

A15

Y1

...A

1...

GG

INT

R

INTA

Page 10: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

10(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Han

dlin

g m

ore

than

1 I

RQ

If a

ny o

fIR

Qx

goes

low

, the

NA

ND

goe

s lo

w r

eque

stin

g an

inte

rrup

t.

Not

e th

at if

mor

e th

an o

ne IR

Q g

oes

low

, a u

niqu

e in

terr

upt v

ecto

r is

gen

er-

ated

and

an

inte

rrup

t pri

orit

y ne

eds

to b

e de

fined

.Th

e In

terr

upt V

ecto

r ta

ble

mus

t be

expa

nded

to a

ccom

mod

ate

this

.

D0

D1

D6

D5

D4

D3

D2

D7

INTA

VC

C

74A

LS24

4Y

1...

A1

...G

G

INTR

IRQ

0

IRQ

6

65

43

21

0Ve

ctIR

Qs

11

11

11

0FE

H1

11

11

01

FDH

11

11

01

1FB

H1

11

01

11

F7H

11

01

11

1EF

H1

01

11

11

DFH

01

11

11

1BF

H

Page 11: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

11(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Dai

sy-C

hain

ed M

echa

nism

for

Mul

tipl

e IR

Qs

82C

55D

0

D7

A0

A7

B7

B0

C7

C0

CS

RD

WR

A0

A1

Res

et

82C

55D

0

D7

A0

A7

B7

B0

C7

C0

CS

RD

WR

A0

A1

Res

et

74A

LS32

74A

LS32Onl

y on

e in

terr

upt v

ecto

rre

quir

ed. Prio

rity

is d

eter

min

ed in

the

ISR

thro

ugh

polli

ng

The

sche

me

give

n ea

rlie

rth

at p

ulls

the

bus

high

(FFH

)ca

n be

use

d as

the

vect

or.

the

indi

vidu

al 8

2C55

s.

Page 12: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

12(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8259

A P

rogr

amm

able

Int

erru

pt C

ontr

olle

rT

he82

59A

adds

8ve

ctor

edpr

iori

tyen

code

din

terr

upts

toth

em

icro

proc

esso

r.

Itca

nbe

expa

nded

to64

inte

rrup

treq

uest

sby

usin

gon

em

aste

r82

59A

and

8sl

ave

unit

s.

CS

and

WR

mus

t be

deco

ded.

Oth

er c

onne

ctio

ns a

re d

irec

t to

mic

ro.

8259

AD

0D

1D

2D

3D

4D

5D

6D

7A

0C

SR

DW

RSP

/EN

INT

INTA

IR0

IR1

IR2

IR3

IR4

IR5

IR6

IR7

CA

S0C

AS1

CA

S2

Con

nect

to a

ny8-

bit b

ank.

Bidi

rect

iona

l.C

onne

ct e

ithe

r to

dev

ices

or to

ups

trea

m s

lave

825

9As

Page 13: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

13(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8259

A P

rogr

amm

able

Int

erru

pt C

ontr

olle

rT

he m

eani

ng o

f the

oth

er c

onne

ctio

ns:

WR C

onne

cts

to a

wri

te s

trob

e si

gnal

(one

of 8

for

the

Pent

ium

).R

D Con

nect

s to

the

IOR

C s

igna

l. IN

T Con

nect

s to

the

INTR

pin

on

the

mic

ropr

oces

sor.

INTA C

onne

cts

to th

eIN

TA p

in o

n th

e m

icro

proc

esso

r. A

0 Sele

cts

diff

eren

t com

man

d w

ords

in th

e 82

59A

.C

S Chi

p se

lect

- en

able

s th

e 82

59A

for

prog

ram

min

g an

d co

ntro

l. S

P/EN Slav

ePr

ogra

m(1

form

aste

r,0

fors

lave

)/En

able

Buff

er(c

ontr

ols

the

data

bus

tran

siev

ers

whe

n in

buf

fere

d m

ode)

. C

AS2

-CA

S0U

sed

as o

utpu

ts fr

om th

e m

aste

r to

the

slav

es in

cas

cade

d sy

stem

s.

Page 14: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

14(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8259

A P

rogr

amm

able

Int

erru

pt C

ontr

olle

rA

sin

gle

8259

A c

onne

cted

in th

e 80

86.

D0

D1

D2

D3

D4

D5

D6

D7

A0

CS

RD

WR

SP/E

NIN

TIN

TA

IR0

IR1

IR2

IR3

IR4

IR5

IR6

IR7

CA

S0C

AS1

CA

S2I1 I2 I3 I4 I5 I6 I7 I8 I9 I1

0

16L8O1

O2

I16

I15

I14

I13

I12

I11

M/I

OA

0A

2A

3A

4A

5A

6A

7A

8A

9

D7-

D0

A1

WA

IT2

A10

A11

A12

A13

A14

A15

IOR

CIO

WC

10K

VC

C

Hig

h in

dica

tes

mas

ter

mod

e.

INTR

INTA

Wri

te th

e pr

ogra

m to

dec

ode

the

8259

Aat

por

ts 0

400H

and

040

2H.

Page 15: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

15(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8259

A P

rogr

amm

able

Int

erru

pt C

ontr

olle

r

D0

D7

A0

CS

RD

WR

SP/E

NIN

TIN

TA

IR0

IR7

CA

S0C

AS1

CA

S2

I1 I2 I3 I4 I5 I6 I7 I8 I9 I10

16L8O1

O2

I16

I15

I14

I13

I12

O3

M/I

OA

0A

2A

3A

4A

5A

6A

7A

8A

9

A1

WA

IT2

A10

A11

A12

A13

A14

A15

RD

WR

INTR

INTA

D0

D7

A0

CS

RD

WR

SP/E

NIN

TIN

TA

IR0

IR7

CA

S0C

AS1

CA

S2

IR2

GD

ir

74LS245

GD

ir

74LS245

D7-

D0

Dev

ices

Dev

ices

Buffer Buffer

Page 16: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

16(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Pro

gram

min

g th

e 82

59A

Prog

ram

med

by

Init

ializ

atio

n (I

CW

s) a

nd O

pera

tion

(OC

Ws)

Com

man

dW

ords

.

Ther

e ar

e 4

ICW

s.A

t pow

er-u

p, IC

W1,

ICW

2 an

d IC

W4

mus

t be

sent

.If

ICW

1 in

dica

tes

casc

ade

mod

e, th

en IC

W3

mus

t als

o be

sen

t.

ICW

1:

LTI

M in

dica

tes

if IR

Q li

nes

are

posi

tive

edg

e-tr

igge

red

or le

vel-

trig

-ge

red.

D1

D0

D3

D2

D5

D4

D7

D6

A0

IC4

SNG

LX

LTIM

10

1 =

IC

W4

Nee

ded

0 =

No

ICW

4 N

eede

d

1 =

Sin

gle

0 =

Cas

cade

Mod

e

1 =

Lev

el T

rigg

ered

Mod

e0

= E

dge

Tri

gger

ed M

ode

XX

X

Page 17: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

17(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Pro

gram

min

g th

e 82

59A

ICW

2:

The

se b

its

dete

rmin

e th

e ve

ctor

num

bers

use

d w

ith

the

IRQ

inpu

ts.

For

exam

ple,

if p

rogr

amm

ed to

gen

erat

e ve

ctor

s 08

H-0

FH, 0

8H is

plac

ed in

to th

ese

bit p

osit

ions

. IC

W3:

D1

D0

D3

D2

D5

D4

D7

D6

A0 1

T7

T5

T6

T4

T3

T7-

T3

of I

nter

rupt

Vec

tor

Add

ress

(80

86/8

088

Mod

e)

XX

X

Low

ord

er b

its a

re 0

sin

ce th

ere

are

8 in

terr

upts

.

D1

D0

D3

D2

D5

D4

D7

D6

A0 1

S 7S 5

S 6S 4

S 3S 2

S 1S 0

1 =

IR

Inp

ut d

oes

not h

ave

a sl

ave

0 =

IR

Inp

ut h

as a

sla

ve

Thi

s re

gist

er is

trea

ted

as a

mas

k,w

ith 1

’s in

dica

ting

the

IRQ

cha

nnel

sco

nnec

ted

to m

aste

r/sl

ave

8259

As.

Page 18: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

18(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Pro

gram

min

g th

e 82

59A

ICW

4:

Fully

nes

ted

mod

e al

low

s th

e hi

ghes

t-pr

iori

ty in

terr

upt r

eque

st fr

om a

slav

eto

bere

cogn

ized

byth

em

aste

rw

hile

itis

proc

essi

ngan

othe

rin

ter-

rupt

from

a s

lave

.

AEO

I, if

1, i

ndic

ates

that

an

inte

rrup

t aut

omat

ical

ly r

eset

s th

e in

terr

upt

requ

est b

it, o

ther

wis

e O

CW

2 is

con

sult

ed fo

r EO

I pro

cess

ing.

D1

D0

D3

D2

D5

D4

D7

D6

A0 1

00

0SF

NM

BU

FM

/SA

EO

I1

1 =

AU

TO

EO

I0

= N

OR

MA

L E

OI

0X

10

11

Non

-Buf

fere

d M

ode

Buf

fere

d M

ode:

Slav

eB

uffe

red

Mod

e:M

aste

r

1 =

Spe

cial

Ful

ly N

este

d M

ode

0 =

Not

Spe

cial

Ful

lyN

este

d M

ode

Page 19: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

19(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Pro

gram

min

g th

e 82

59A

The

Ope

rati

on C

omm

and

Wor

ds (O

CW

s) a

re u

sed

to d

irec

t the

ope

rati

on o

fth

e 82

59A

. O

CW

1:

OC

W1

is u

sed

to r

ead

or s

et th

e in

terr

upt m

ask

regi

ster

.If

abi

tis

set,

itw

illtu

rnof

f(m

ask)

the

corr

espo

ndin

gin

terr

upti

nput

. O

CW

2:

Onl

y pr

ogra

mm

ed w

hen

the

AEO

I mod

e in

ICW

4 is

0.

Allo

ws

you

to c

ontr

ol p

rior

itie

s af

ter

each

inte

rrup

t is

proc

esse

d.

D1

D0

D3

D2

D5

D4

D7

D6

A0 1

M7

M5

M6

M4

M3

M2

M1

M0

1 =

Mas

k Se

t

INT

ER

RU

PT M

ASK

0 =

Mas

k R

eset

D1

D0

D3

D2

D5

D4

D7

D6

A0 0

RE

OI

SL0

0L

2L

1L

0

Page 20: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

20(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Pro

gram

min

g th

e 82

59A

OC

W2:

Non

-spe

cific

EO

I: H

ere,

the

ISR

set

s th

is b

it to

indi

cate

EO

I. Th

e 82

59A

auto

mat

ical

ly d

eter

min

es w

hich

inte

rrup

t was

act

ive

and

re-e

nabl

es it

and

low

er p

rior

ity

inte

rrup

ts.

Spec

ific

EOI:

ISR

res

ets

a sp

ecifi

c in

terr

upt r

eque

st g

iven

by

L 2-L

0.

Rot

ate

com

man

dsca

use

prio

rity

tobe

rota

ted

w.r.

t.th

ecu

rren

tone

bein

gpr

oces

sed.

Set p

rior

ity:

allo

ws

the

sett

ing

of th

e lo

wes

t pri

orit

y in

terr

upt (

L 2-L

0).

D1

D0

D3

D2

D5

D4

D7

D6

A0 0

RE

OI

SL0

0L

2L

1L

0

00

10

11

10

11

00

00

01

11

11

00

10

Non

-Spe

cific

EO

I C

omm

and

Rot

ate

on N

on-S

peci

fic E

OI

Com

man

d*S

peci

fic E

OI

Com

man

d

Rot

ate

on A

utom

atic

EO

I M

ode

(Set

)R

otat

e on

Aut

omat

ic E

OI

Mod

e (C

lear

)*R

otat

e on

Spe

cific

EO

I C

omm

and

*Set

Pri

ority

Com

man

dN

o O

pera

tion

*L0-

L2

are

used

}

}}

End

of

Inte

rrup

tA

utom

atic

Rot

atio

n

Spec

ific

Rot

atio

n

Page 21: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

21(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Pro

gram

min

g th

e 82

59A

OC

W3:

If p

ollin

g is

set

, the

nex

t rea

d op

erat

ion

will

rea

d th

e po

ll w

ord.

If th

e le

ftm

ost b

it is

set

in th

e po

ll w

ord,

the

righ

tmos

t 3 b

its

indi

cate

the

acti

ve in

terr

upt r

eque

st w

ith

high

est p

rior

ity.

Allo

ws

ISR

to s

ervi

ce h

ighe

st p

rior

ity

inte

rrup

t.

Ther

e ar

e th

ree

stat

us r

egis

ters

, Int

erru

pt R

eque

st R

egis

ter

(IR

R),

In-S

er-

vice

Reg

iste

r (I

SR) a

nd In

terr

upt M

ask

Reg

iste

r (I

MR

). IR

R: I

ndic

ates

whi

ch in

terr

upt r

eque

st li

nes

are

acti

ve.

ISR

: Lev

el o

f the

inte

rrup

t bei

ng s

ervi

ced.

IMR

: A m

ask

that

indi

cate

s w

hich

inte

rrup

ts a

re o

n/of

f.

D1

D0

D3

D2

D5

D4

D7

D6

A0 0

SMM

ESM

M0

1R

RR

ISP

0

1 =

Pol

l Com

man

d0

= N

o Po

ll C

omm

and

stat

us r

egis

ter,

IRR

or

ISR

, is

to b

e re

ad.

Ope

rati

on o

fsp

ecia

l mas

k re

gist

er

Indi

cate

s w

hich

Page 22: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

22(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Pro

gram

min

g th

e 82

59A

ISR

upd

ate

proc

edur

e w

ith r

otat

ing

prio

rity

con

figur

ed.

IS1

IS0

IS3

IS2

IS5

IS4

IS7

IS6

ISR

STA

TU

S

PRIO

RIT

Y

Bef

ore

IR4

acce

pted

Low

est P

rior

ityH

ighe

st P

rior

ity

01

10

00

00

76

42

01

35

IS1

IS0

IS3

IS2

IS5

IS4

IS7

IS6

ISR

STA

TU

S

PRIO

RIT

Y

Aft

erIR

4 ac

cept

ed

Low

est P

rior

ityH

ighe

st P

rior

ity

01

00

00

00

21

75

34

60P

roce

ss I

R4

Page 23: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

23(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Inte

rfac

ing

1655

0 U

AR

T u

sing

825

9AIn

the

follo

win

g co

nfigu

rati

on th

e 16

550

is c

onne

cted

to th

e 82

59A

thro

ugh

IR0.

An

inte

rrup

t is

gene

rate

d, if

ena

bled

thro

ugh

the

inte

rrup

t con

trol

reg

iste

r,w

hen

eith

er:

The

tran

smit

ter

is r

eady

to s

end

anot

her

char

acte

r. T

he r

ecei

ver

has

rece

ived

a c

hara

cter

. A

n er

ror

is d

etec

ted

whi

le r

ecei

ving

dat

a. A

mod

em in

terr

upt o

ccur

s.

The

1655

0 is

dec

oded

at 4

0H a

nd 4

7H.

The

825

9A is

dec

oded

at 4

8H a

nd 4

9H.

Prog

ram

in te

xt s

how

s th

e st

eps

invo

lved

in p

rogr

amm

ing

both

dev

ices

.Si

nce

the

1655

0 ge

nera

tes

only

one

inte

rrup

t req

uest

for

each

of t

heab

ove

inte

rrup

ts, t

he 1

6550

mus

t be

polle

d.

Rem

embe

r th

e in

terr

upt i

dent

ifica

tion

reg

iste

r of

the

1655

0?

Page 24: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

24(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

Inte

rfac

ing

1655

0 U

AR

T u

sing

825

9A

Dat

a B

us (

D0-

D7)

A0

D7 D0

D7

SIN

SOU

T

Seri

al D

ata

BA

UD

OU

TR

CL

KR

TS

CT

SD

TR

DSR

DC

DR

IO

UT

1O

UT

2

D0

A1

A2

CS0

CS1

CS2

10K

VC

C

MR

RD

RD

A0

Res

et

WR

WR

AD

SX

INX

OU

TIN

TR

IR0

IR7

CA

S0C

AS1

CA

S2

Oth

erIn

terr

upts

RD

WR

A0

CS

RD

WR

SP/E

NIN

TIN

TA

INT

AIN

TR

10K

VC

C

A1

A2

A3

A4

A5

A6

A8

A9

A10

A7

A11

A12

A13

A14

A15

IO/M

40H

-47H

1655

0

8259

A

16L

8

48H

-49H

18.4

32 M

Hz

Page 25: CMPE 310 (April 24, 2002)Interrupts I CMPE 310 1 (April 24, 2002) UMBC U M B C U N I V E R S I T Y O F M A R Y L A N D B A L T I M O R E OC U N T Y 1 9 6 Interrupts 6 Interr upt pr

Syst

ems

Des

ign

& P

rogr

amm

ing

Inte

rrup

ts I

CM

PE 3

10

25(A

pril

24, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

1655

0 U

AR

T I

nter

rupt

s

Text

give

sIS

Rpr

ogra

mm

ing

exam

ples

that

show

init

ializ

atio

nan

dop

erat

ion.

01

23

45

67

ER

ET

EL

EM

00

00

PNID

IDID

00

00

Enab

le R

ecie

ver

Inte

rrup

t

Enab

le T

rans

mit

ter

Inte

rrup

t

Enab

le L

ine

Inte

rrup

t

Enab

le M

odem

Inte

rrup

t0

= di

sabl

ed

01

23

45

67In

terr

upt I

dent

ifica

tion

Reg

iste

r

Inte

rrup

t Pen

ding

0 =

inte

rrup

t pen

ding

1 =

no in

terr

upt

Inte

rrup

t Ide

ntifi

cati

onbi

ts (d

efine

d in

text

)

Inte

rrup

t Con

trol

Reg

iste

r

1 =

enab

led

0 =

disa

bled

1 =

enab

led

0 =

disa

bled

1 =

enab

led

0 =

disa

bled

1 =

enab

led