Interrupt service routines (isrs) – Texas Instruments TMS320C2XX User Manual

Page 128

Advertising
background image

Interrupts

5-29

Program Control

Figure 5–10. Nonmaskable Interrupt Operation Flow Chart

Interrupt request sent to CPU

Interrupt acknowledged

TRAP

instruction?

Yes

No

INTM bit set to 1

PC saved on stack

Interrupt service routine run

Return instruction restores PC

Program continues

5.6.8

Interrupt Service Routines (ISRs)

After an interrupt has been requested and acknowledged, the CPU follows an
interrupt vector to the ISR. The ISR is the program code that actually performs
the tasks requested by the interrupt. While performing these tasks, the ISR
may also be:

-

Saving and restoring register values

-

Managing ISRs within ISRs

Saving and restoring register values

Only the incremented program counter value is stored automatically before
the CPU enters an interrupt service routine (ISR). You must design the ISR to
save and then restore any other important register values. For example, if your
ISR will need to perform a multiplication, it will need to use the product register
(PREG). If the value currently in the PREG must be in the PREG after the ISR,
the ISR must save the value, perform the new multiplication, store the resulting
PREG value, and then reload the original value. You may find that certain reg-
isters will need to be saved during most ISRs. If so, you can copy a common
save and restore routine and then individualize it for each interrupt.

Advertising