![Cypress enCoRe V CY7C643 Series Скачать руководство пользователя страница 44](http://html1.mh-extra.com/html/cypress/encore-v-cy7c643-series/encore-v-cy7c643-series_technical-reference-manual_2706365044.webp)
enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H
44
5. Interrupt Controller
This chapter presents the Interrupt Controller and its associated registers. The interrupt controller provides a mechanism for a
hardware resource in enCoRe V devices to change program execution to a new address without regard to the current task
being performed by the code being executed. For a quick reference of all enCoRe V registers in address order, refer to the
Register Reference chapter on page 163
.
5.1
Architectural Description
shows a block diagram of the Interrupt Controller, illustrating the concepts of
Figure 5-1. Interrupt Controller Block Diagram
This is the sequence of events that occur during interrupt
processing.
1. An interrupt becomes active, either because (a) the
interrupt condition occurs (for example, a timer expires),
(b) a previously posted interrupt is enabled through an
update of an interrupt
register, or (c) an interrupt is
pending and GIE is set from ‘0’ to ‘1’ in the CPU Flag
register.
2. The current executing instruction finishes.
3. The internal interrupt service routine (ISR) executes, tak-
ing 13 cycles. During this time, the following actions
occur:
❐
The PCH, PCL, and Flag register (CPU_F) are
pushed onto the stack (in that order).
❐
The CPU_F register clears. Because this clears the
GIE bit to ‘0’, additional interrupts are temporarily dis-
abled.
❐
The PCH (PC[15:8]) is cleared to zero.
❐
The interrupt vector is read from the interrupt control-
ler and its value is placed into PCL (PC[7:0]). This
sets the program counter to point to the appropriate
address in the interrupt table (for example, 0014h for
the GPIO interrupt).
4. Program execution vectors to the interrupt table. Typi-
cally an
LJMP
instruction in the interrupt table sends exe-
cution to the user's interrupt service routine for this
interrupt. (See
Instruction Set Summary on page 27
.)
5. The ISR executes. Interrupts are disabled because GIE
= 0. In the ISR, interrupts can be re-enabled if necessary
by setting GIE = 1 (take care to avoid stack overflow in
this case).
6. The ISR ends with an
RETI
instruction. This pops the
Flag register, PCL, and PCH from the stack, restoring
those registers. The restored Flag register re-enables
interrupts because GIE = 1 again.
M8C Core
Interrupt
Source
(Timer,
GPIO, etc.)
Interrupt Taken
or
Posted
Interrupt
Pending
Interrupt
GIE
Interrupt Vector
Mask Bit Setting
D
R
Q
1
Priority
Encoder
Interrupt
Request
...
INT_MSKx
INT_CLRx:n Write
CPU_F[0]
...