C161U
Interrupt and Trap Functions
Preliminary Data Sheet
133
02.2000
PRELIMINARY
PRE
LI
M
INAR
Y
- E
XCE
RP
T
-
FEIxIC (See Table)
SFR
Reset Value: - - 00
HH
Note: Please refer to the general Interrupt Control Register description for an
explanation of the control fields.
Table 25
Fast External Interrupt Control Register Addresses
7.9
Trap Functions
Traps interrupt the current execution similar to standard interrupts. However, trap
functions offer the possibility to bypass the interrupt system's prioritization process in
cases where immediate system reaction is required. Trap functions are not maskable
and always have priority over interrupt requests on any priority level.
The C161U provides two different kinds of trapping mechanisms. Hardware traps are
triggered by events that occur during program execution (eg. illegal access or undefined
opcode), software traps are initiated via an instruction within the current execution flow.
Software Traps
The TRAP instruction is used to cause a software call to an interrupt service routine. The
trap number that is specified in the operand field of the trap instruction determines which
vector location in the address range from 00’0000H through 00’01FCH will be branched
to.
Executing a TRAP instruction causes a similar effect as if an interrupt at the same vector
had occurred. PSW, CSP (in segmentation mode), and IP are pushed on the internal
system stack and a jump is taken to the specified vector location. When segmentation is
enabled and a trap is executed, the CSP for the trap service routine is set to code
segment 0. No Interrupt Request flags are affected by the TRAP instruction. The
interrupt service routine called by a TRAP instruction must be terminated with a RETI
(return from interrupt) instruction to ensure correct operation.
Note: The CPU level in register PSW is not modified by the TRAP instruction, so the
service routine is executed on the same priority level from which it was invoked.
Register
Address
External Interrupt
FEI0IC
FF88
H / C4H
EX0IN
FEI1IC
FF8A
H / C5H
EX1IN
5
4
3
2
1
0
11
10
9
8
7
6
15
14
13
12
rw
-
rw
-
FEIx
IE
FEIx
IR
ILVL
GLVL