
C161U
Interrupt and Trap Functions
Data Sheet
126
2001-04-19
7.8
External Interrupts
Although the C161U has no dedicated INTR input pins, it provides many possibilities to
react on external asynchronous events by using a number of I/O lines for interrupt input.
The interrupt function may either be combined with the pin’s main function or may be
used instead of it, ie. if the main pin function is not required.
Interrupt signals may be connected to:
EX1IN...EX0IN, the fast external interrupt input pins,
T4IN, the timer input pin,
For each of these pins either a positive, a negative, or both a positive and a negative
external transition can be selected to cause an interrupt or PEC service request. The
edge selection is performed in the control register of the peripheral device associated
with the respective port pin. The peripheral must be programmed to a specific operating
mode to allow generation of an interrupt by the external signal. The priority of the
interrupt request is determined by the interrupt control register of the respective
peripheral interrupt source, and the interrupt vector of this source will be used to service
the external interrupt request.
Note:
In order to use any of the listed pins as external interrupt input, it must be switched
to input mode via its direction control bit DPx.y in the respective port direction
control register DPx.
Pin T4IN can be used as external interrupt input pin when the associated auxiliary timer
T4 in block GPT1 is configured for capture mode. This mode is selected by programming
the mode control field T4M in control register T4CON to 101
B
. The active edge of the
external input signal is determined by bit field T4I. When these field are programmed to
X01
B
, interrupt request flag T4IR in register T4IC will be set on a positive external
transition at pin T4IN. When T4I is programmed to X10
B
, then a negative external
transition will set the corresponding request flag. When T4I is programmed to X11
B
, both
a positive and a negative transition will set the request flag. In all three cases, the
contents of the core timer T3 will be captured into the auxiliary timer register T4 based
on the transition at pin T4IN. When the interrupt enable bit T4IE are set, a PEC request
or an interrupt request for vector T4INT will be generated.
Table 25
Pins to be used as External Interrupt Inputs
Port Pin
P2.1-0/EX1-0IN
P3.5/T4IN
Original Function
Fast external interrupt input pin
Auxiliary timer T4 input pin
Control Register
EXICON
T4CON