0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
2
2
3
3
1
1
1
1
1
1
1
1
1
selected input clock
prescaler counter
timer module counting is up.
PS[2:0] = 001
CNTIN = 0x0000
timer module counter
Figure 27-35. Example of the Prescaler Counter
27.4.3 Counter
The TPM has a 16-bit counter that is used by the channels either for input or output
modes. The counter updates from the selected clock divided by the prescaler.
The TPM counter has these modes of operation:
)
• up-down counting (see
)
27.4.3.1 Up Counting
Up counting is selected when (CPWMS = 0)
The value of zero is loaded into the TPM counter, and the counter increments until the
value of MOD is reached, at which point the counter is reloaded with zero.
The TPM period when using up counting is (MOD + 0x0001) × period of the TPM
counter clock.
The TOF bit is set when the TPM counter changes from MOD to zero.
Chapter 27 Timer/PWM Module (TPM)
KL02 Sub-Family Reference Manual, Rev. 2.1, July 2013
Freescale Semiconductor, Inc.
423