beautypg.com

5 interrupt priorities – Texas Instruments MSC1210 User Manual

Page 113

background image

Interrupt Priorities

10-7

Interrupts

10.5 Interrupt Priorities

The MSC1210 offers three levels of interrupt priority: highest, high, and low.
By using interrupt priorities, higher priority may be assigned to certain interrupt
conditions. The highest priority is reserved for the auxiliary interrupt that vec-
tors through address 0033

H

—the auxiliary interrupt is always of highest prior-

ity and no other interrupt may be assigned that priority.

All other interrupts may be assigned either high or low priority. For example,
assume the Timer 1 interrupt has been enabled to be automatically called ev-
ery instance Timer 1 overflows. Additionally, the serial interrupt has been en-
abled to be called every time a character is received via the serial port. Howev-
er, in this case, receiving a character is much more important than the timer
interrupt. Therefore, if the Timer 1 interrupt is already executing, the serial in-
terrupt must interrupt the Timer 1 interrupt. When the serial interrupt is com-
plete, control passes back to the Timer 1 interrupt and finally back to the main
program. This may be accomplished by assigning a high priority to the serial
interrupt and a low priority to the Timer 1 interrupt.

Interrupt priorities are controlled by the IP (B8

H

) or EIP (F8

H

) SFRs. These

SFRs have the following formats, as shown in Table 10−5 and Table 10−6.

Table 10−5.IP (B8

H

) SFR

Bit

Name

Bit Address

Explanation of Function

7

BF

H

Undefined

6

BE

H

Undefined

5

BD

H

Undefined

4

PS

BC

H

Serial Interrupt Priority

3

PT1

BB

H

Timer 1 Interrupt Priority

2

PX1

BA

H

External 1 Interrupt Priority

1

PT0

B9

H

Timer 0 Interrupt Priority

0

PX0

B8

H

External 0 Interrupt Priority

Table 10−6.EIP (F8

H

) SFR

Bit

Name

Bit Address

Explanation of Function

7

FF

H

Undefined (set to 1)

6

FE

H

Undefined (set to 1)

5

FD

H

Undefined (set to 1)

4

PWDI

FC

H

Watchdog Interrupt Priority

3

PX5

FB

H

External Interrupt 5 Priority

2

PX4

FA

H

External Interrupt 4 Priority

1

PX3

F9

H

External Interrupt 3 Priority

0

PX2

F8

H

External Interrupt 2 Priority