beautypg.com

Texas Instruments MSC1210 User Manual

Page 114

background image

Interrupt Triggering

10-8

When considering interrupt priorities, the following rules apply:

1) Nothing can interrupt the highest-priority auxiliary interrupt, not even

another auxiliary interrupt.

2) Only an auxiliary interrupt (highest priority) can interrupt a high-priority in-

terrupt.

3) A high-priority interrupt may interrupt a low-priority interrupt.

4) A low-priority interrupt may only occur if no other interrupt is currently execut-

ing.

5) If two interrupts occur at the same time, the interrupt with higher priority

will execute first. If both interrupts are of the same priority, the interrupt that
is serviced first by the polling sequence will be executed first.

10.6 Interrupt Triggering

When an interrupt is triggered, the following actions are taken automatically
by the microcontroller:

1) The current program counter is saved on the stack, low byte first and high

byte second.

2) Interrupts of the same and lower priority are blocked.

3) In the case of timer and external interrupts, the corresponding interrupt

flag is cleared.

4) Program execution transfers to the corresponding interrupt handler vector

address.

5) The interrupt handler routine, written by the developer, is executed.

Take special note of the third step. If the interrupt being handled is a timer or
external interrupt, the microcontroller automatically clears the interrupt flag be-
fore passing control to the interrupt handler routine. This means it is not neces-
sary that the bit be cleared in code.

10.7 Exiting Interrupts

An interrupt ends when your program executes the RETI (return from interrupt)
instruction. When the RETI instruction is executed, the following actions are
taken by the microcontroller:

1) Two bytes are popped off the stack into the program counter to restore nor-

mal program execution, high byte first and low byte second.

2) Interrupt status is restored to its pre-interrupt status. This means interrupts

of the same and higher level may once again be executed.