Datasheet

12.4.3.1 Up counting
Up counting is selected when (CPWMS = 0).
CNTINH:L defines the starting value of the count and MODH:L defines the final value
of the count; see the following figure. The value of CNTINH:L is loaded into the FTM
counter, and the counter increments until the value of MODH:L is reached, at which
point the counter is reloaded with CNTINH:L.
The FTM period when using up counting is (MODH:L – CNTINH:L + 0x0001) × period
of the FTM counter clock.
The TOF bit is set when the FTM counter changes from MODH:L to CNTINH:L.
FTM counting is up
FTM counter (in decimal values)
period of FTM counter clock
MODH:L = 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
CNTINH:L = 0xFFFC (in two's complement is equal to -4)
period of counting = (MODH:L - CNTINH:L + 0x0001) x period of FTM counter clock
Figure 12-188. Example of FTM up and signed counting
If (CNTINH:L = 0x0000), the FTM counting is equivalent to TPM up counting; that is,
up and unsigned counting. See the following figure. If (CNTINH[7] = 1), then the initial
value of the FTM counter is a negative number in two's complement format, so the FTM
counting is up and signed. Conversely, if (CNTINH[7] = 0 and CNTINH:L ≠ 0x0000),
then the initial value of the FTM counter is a positive number, therefore the FTM
counting is up and unsigned.
Functional Description
MC9S08PA60 Reference Manual, Rev. 1, 9/2012
326 Freescale Semiconductor, Inc.