66
CY8C28xxx PSoC Programmable System-on-Chip TRM, Document No. 001-52594 Rev. *G
Interrupt Controller
4. Program execution vectors to the interrupt table. Typi-
cally, a LJMP instruction in the interrupt table sends exe-
cution to the user's interrupt service routine (ISR) for this
interrupt. (See
“Instruction Set Summary” on page 40
.)
5. The ISR executes. Note that interrupts are disabled
because GIE = 0. In the ISR, interrupts can be re-
enabled if desired, by setting GIE = 1 (take care to avoid
stack overflow in this case).
6. The ISR ends with a RETI instruction. This pops the Flag
register, PCL, and PCH from the stack, restoring those
registers. The restored Flag register re-enables inter-
rupts, because GIE = 1 again.
7. Execution resumes at the next instruction, after the one
that occurred before the interrupt. However, if there are
more pending interrupts, the subsequent interrupts will
be processed before the next normal program instruc-
tion.
Interrupt Latency.
The time between the assertion of an
enabled interrupt and the start of its ISR can be calculated
using the following equation:
Latency =
Equation 1
Time for current instruction to
Time for M8C to change program counter to interrupt a
Time for LJMP instruction in interrupt table to execute.
For example, if the 5-cycle JMP instruction is executing
when an interrupt becomes active, the total number of CPU
clock cycles before the ISR begins is as follows:
(1 to 5 cycles for JMP to finish) +
Equation 2
(13 cycles for interrupt routine) +
(7 cycles for LJMP) = 21 to 25 cycles.
In the example above, at 24 MHz, 25 clock cycles take
1.042
s.
Interrupt Priority.
The priorities of the interrupts only come
into consideration if more than one interrupt is pending dur-
ing the same instruction cycle. In this case, the priority
encoder (see
) generates an interrupt vector for
the highest priority interrupt that is pending.
5.1.1
Posted versus Pending Interrupts
An interrupt is posted when its interrupt conditions occur.
This results in the flip-flop in
clocking in a ‘1’. The
interrupt will remain posted until the interrupt is taken or until
it is cleared by writing to the appropriate INT_CLRx register.
A posted interrupt is not pending unless it is enabled by set-
ting its interrupt mask bit (in the appropriate INT_MSKx reg-
ister). All pending interrupts are processed by the Priority
Encoder to determine the highest priority interrupt which will
be taken by the M8C if the Global Interrupt Enable bit is set
in the CPU_F register.
Disabling an interrupt by clearing its interrupt mask bit (in the
INT_MSKx register) does not clear a posted interrupt, nor
does it prevent an interrupt from being posted. It simply pre-
vents a posted interrupt from becoming pending.
It is especially important to understand the functionality of
clearing posted interrupts, if the configuration of the PSoC
device is changed by the application.
For example, if a digital PSoC block is configured as a coun-
ter and has posted an interrupt but is later reconfigured to a
serial communications receiver, the posted interrupt from
the counter will remain. Therefore, if the digital PSoC block's
INT_MSKx bit is set after configuring the block as a serial
communications receiver, a pending interrupt is generated
immediately. To prevent the carryover of posted interrupts
from one configuration to the next, the INT_CLRx registers
should be used to clear posted interrupts prior to enabling
the digital PSoC block.
Содержание CY8C28 series
Страница 65: ...64 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G RAM Paging ...
Страница 85: ...84 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Internal Main Oscillator IMO ...
Страница 93: ...92 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G External Crystal Oscillator ECO ...
Страница 97: ...96 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Phase Locked Loop PLL ...
Страница 125: ...124 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Страница 311: ...310 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G IDAC_CR0 1 FDh ...
Страница 317: ...316 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Страница 393: ...392 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Страница 425: ...424 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Analog Reference ...
Страница 461: ...460 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Two Column Limited Analog System ...
Страница 477: ...476 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Digital Clocks ...
Страница 483: ...482 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Multiply Accumulate MAC ...
Страница 513: ...512 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Internal Voltage Reference ...
Страница 523: ...522 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Switch Mode Pump SMP ...
Страница 533: ...532 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G I O Analog Multiplexer ...
Страница 537: ...536 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Real Time Clock RTC ...
Страница 561: ...560 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...