Specifications
General-Purpose (GP) Timers
6-24
The direction of counting is indicated for the timer in this mode by the corre-
sponding direction indication bit in GPTCONA/B: 1 means counting up;
0 means counting down. Either the external clock from the TCLKINA/B pin or
the Internal device clock can be used as the input clock for the timer in this
mode.
Figure 6–5 shows the directional up-/down-counting mode of the GP timers.
Figure 6–5. GP Timer Directional Up-/Down-Counting Mode: Prescale Factor 1 and
TxPR = 3
CLK
Timer
TxCON[6]
TDIRA/B
value
Timer
TxPR=3
1
2
3
0
1
2
3
2
1
0
3
2
1
0
65535
65534
65533
0
The directional up-/down-counting mode of GP timer 2/4 can be used with the
quadrature encoder pulse (QEP) circuits in the EV module. The QEP circuits
provide both the counting clock and direction for GP timer 2/4 in this case. This
mode of operation can also be used to time the occurrence of external events
in motion/motor control and power electronics applications.
Continuous Up-/Down-Counting Mode
This mode of operation is the same as the directional up-/down-counting
mode, but the TDIRA/B pin has no effect on the counting direction. The count-
ing direction only changes from up to down when the timer reaches the period
value (or FFFFh if the initial timer value is greater than the period). The timer
direction only changes from down to up when the timer reaches 0.
The period of the timer in this mode is 2*(TxPR) cycles of the scaled clock input
except for the first period. The duration of the first counting period is the same
if the timer counter is 0 when counting starts.
The initial value of the GP timer counter can be any value between 0h and
FFFFh inclusive. When the initial value is greater than that of the period regis-
ter, the timer counts up to FFFFh, resets to 0, and continues the operation as










