
C161U
Interrupt and Trap Functions
Data Sheet
112
2001-04-19
decrements to zero. This allows a normal CPU interrupt to respond to a completed PEC
block transfer.
Note:
Modifying the Interrupt Request flag via software causes the same effects as if it
had been set or cleared by hardware.
Interrupt Priority Level and Group Level
The four bits of bit field ILVL specify the priority level of a service request for the
arbitration of simultaneous requests. The priority increases with the numerical value of
ILVL, so 0000
B
is the lowest and 1111
B
is the highest priority level.
When more than one interrupt request on a specific level gets active at the same time,
the values in the respective bit fields GLVL are used for second level arbitration to select
one request for being serviced. Again the group priority increases with the numerical
value of GLVL, so 00
B
is the lowest and 11
B
is the highest group priority.
Note:
All interrupt request sources that are enabled and programmed to the same
priority level must always be programmed to different group priorities. Otherwise
an incorrect interrupt vector will be generated.
Upon entry into the interrupt service routine, the priority level of the source that won the
arbitration and who’s priority level is higher than the current CPU level, is copied into bit
field ILVL of register PSW after pushing the old PSW contents on the stack.
The interrupt system of the C161U allows nesting of up to 15 interrupt service routines
of different priority levels (level 0 cannot be arbitrated).
Interrupt requests that are programmed to priority levels 15 or 14 (ie, ILVL=111X
B
) will
be serviced by the PEC, unless the COUNT field of the associated PECC register
contains zero. In this case the request will instead be serviced by normal interrupt
processing. Interrupt requests that are programmed to priority levels 13 through 1 will
always be serviced by normal interrupt processing.
Note:
Priority level 0000
B
is the default level of the CPU. Therefore a request on level 0
will never be serviced, because it can never interrupt the CPU. However, an
enabled interrupt request on level 0000
B
will terminate the C161U’s Idle mode and
reactivate the CPU.
For interrupt requests which are to be serviced by the PEC, the associated PEC channel
number is derived from the respective ILVL (LSB) and GLVL (see figure below). So
programming a source to priority level 15 (ILVL=1111
B
) selects the PEC channel group
7...4, programming a source to priority level 14 (ILVL=1110
B
) selects the PEC channel
group 3...0. The actual PEC channel number is then determined by the group priority
field GLVL.