C161CS/JC/JI
Derivatives
Interrupt and Trap Functions
User’s Manual
5-26
V3.0, 2001-02
5.8
External Interrupts
Although the C161CS/JC/JI has no dedicated INTR input pins, it provides many
possibilities to react on external asynchronous events by using a number of IO lines for
interrupt input. The interrupt function may either be combined with the pin’s main function
or may be used instead of it, i.e. if the main pin function is not required.
Interrupt signals may be connected to:
CC31IO … CC16IO, the capture input/compare output lines of the CAPCOM2 unit,
CC15IO … CC0IO, the capture input/compare output lines of the CAPCOM1 unit,
T4IN, T2IN, the timer input pins,
CAPIN, the capture input of GPT2.
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.
When port pins CCxIO are to be used as external interrupt input pins, bit field CCMODx
in the control register of the corresponding capture/compare register CCx must select
capture mode. When CCMODx is programmed to 001B, the interrupt request flag CCxIR
in register CCxIC will be set on a positive external transition at pin CCxIO. When
CCMODx is programmed to 010B, a negative external transition will set the interrupt
request flag. When CCMODx = 011B, both a positive and a negative transition will set
the request flag. In all three cases, the contents of the allocated CAPCOM timer will be
Table 5-8
Pins to be Used as External Interrupt Inputs
Port Pin
Original Function
Control Register
P7.7-4/CC31-28IO
CAPCOM register 31-28 capture input
CC31-CC28
P1H.7-4/CC27-24IO
CAPCOM register 27-24 capture input
CC27-CC24
P2.15-8/CC15-8IO
CAPCOM register 15-8 capture input
CC15-CC8
P3.7/T2IN
Auxiliary timer T2 input pin
T2CON
P3.5/T4IN
Auxiliary timer T4 input pin
T4CON
P3.2/CAPIN
GPT2 capture input pin
T5CON