English
Language : 

K60P100M100SF2RM Datasheet, PDF (987/1809 Pages) Freescale Semiconductor, Inc – K60 Sub-Family Reference Manual
39.4.3.1 Up Counting
Chapter 39 FlexTimer (FTM)
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.
CNTIN = 0xFFFC (in two's complement is equal to -4)
MOD = 0x0004
FTM counter (in decimal values) 4 -4 -3 -2 -1 0 1 2 3 4 -4 -3 -2 -1 0 1 2 3 4 -4 -3
TOF bit
set TOF bit
set TOF bit
set TOF bit
period of FTM counter clock
period of counting = (MOD - CNTIN + 0x0001) x period of FTM counter clock
Figure 39-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.
K60 Sub-Family Reference Manual, Rev. 6, Nov 2011
Freescale Semiconductor, Inc.
987