Information

37.4.3.1 Up Counting
Up counting is selected when (QUADEN = 0) and (CPWMS = 0).
CNTIN defines the starting value of the count and MOD defines the final value of the
count (see the following figure). The value of CNTIN is loaded into the FTM counter,
and the counter increments until the value of MOD is reached, at which point the counter
is reloaded with the value of CNTIN.
The FTM period when using up counting is (MOD – CNTIN + 0x0001) × period of the
FTM counter clock.
The TOF bit is set when the FTM counter changes from MOD to CNTIN.
FTM counting is up.
FTM counter (in decimal values)
period of FTM counter clock
MOD = 0x0004
TOF bit
set TOF bit
set TOF bit
set TOF bit
4
-4
-3
-2
-1
-4
-3
-2
-1
0 1
2
3
4 0 1
2
3 4
-4
-3
CNTIN = 0xFFFC (in two's complement is equal to -4)
period of counting = (MOD - CNTIN + 0x0001) x period of FTM counter clock
Figure 37-168. Example of FTM Up and Signed Counting
If (CNTIN = 0x0000), the FTM counting is equivalent to TPM up counting (that is, up
and unsigned counting) (see the following figure). If (CNTIN[15] = 1), then the initial
value of the FTM counter is a negative number in two's complement, so the FTM
counting is up and signed. Conversely if (CNTIN[15] = 0 and CNTIN ≠ 0x0000), then
the initial value of the FTM counter is a positive number, so the FTM counting is up and
unsigned.
Chapter 37 FlexTimer (FTM)
K20 Sub-Family Reference Manual, Rev. 6, Nov 2011
Freescale Semiconductor, Inc. 907