
XC161 Derivatives
Peripheral Units (Vol. 2 of 2)
The General Purpose Timer Units
User’s Manual
14-20
V2.2, 2004-01
GPT_X1, V2.0
Timers T2 and T4 in Counter Mode
Counter mode for an auxiliary timer Tx is selected by setting bitfield TxM in register
TxCON to 001
B
. In counter mode, an auxiliary timer can be clocked either by a transition
at its external input line TxIN, or by a transition of timer T3’s toggle latch T3OTL. The
event causing an increment or decrement of a timer can be a positive, a negative, or both
a positive and a negative transition at either the respective input pin or at the toggle latch.
Bitfield TxI in control register TxCON selects the triggering transition (see
Figure 14-13 Block Diagram of an Auxiliary Timer in Counter Mode
Note: Only state transitions of T3OTL which are caused by the overflows/underflows of
T3 will trigger the counter function of T2/T4. Modifications of T3OTL via software
will NOT trigger the counter function of T2/T4.
Table 14-5
GPT1 Auxiliary Timer (Counter Mode) Input Edge Selection
T2I/T4I
Triggering Edge for Counter Increment/Decrement
X 0 0
None. Counter Tx is disabled
0 0 1
Positive transition (rising edge) on TxIN
0 1 0
Negative transition (falling edge) on TxIN
0 1 1
Any transition (rising or falling edge) on TxIN
1 0 1
Positive transition (rising edge) of T3 toggle latch T3OTL
1 1 0
Negative transition (falling edge) of T3 toggle latch T3OTL
1 1 1
Any transition (rising or falling edge) of T3 toggle latch T3OTL
Auxiliary
Timer Tx
Count
TxIRQ
MCB05397
MUX
Up/Down
0
1
TxEUD
=1
TxUD
TxUDE
MUX
TxRC
TxR
T3R
x = 2, 4
TxI
MUX
TxI.2
TxIN
T3
Toggle
Latch
0
1
0
1
Edge
Select