Up-Down Counting - NXP Semiconductors freescale KV4 Series Reference Manual

Table of Contents

Advertisement

Functional description
FTM counting is up
MOD = 0x0005
CNTIN = 0x0015
load of CNTIN
FTM counter
0x0005 0x0015 0x0016
TOF bit
set TOF bit
Figure 39-171. Example of up counting when the value of CNTIN is greater than the

39.5.3.2 Up-down counting

Up-down counting is selected when:
• QUADEN = 0, and
• CPWMS = 1
CNTIN defines the starting value of the count and MOD defines the final value of the
count. 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 decremented until it
returns to the value of CNTIN and the up-down counting restarts.
The FTM period when using up-down counting is 2 × (MOD – CNTIN) × period of the
FTM counter clock.
The TOF bit is set when the FTM counter changes from MOD to (MOD – 1).
If (CNTIN = 0x0000), the FTM counting is equivalent to TPM up-down counting, that is,
up-down and unsigned counting. See the following figure.
952
...
0xFFFE 0xFFFF 0x0000 0x0001 0x0002 0x0003 0x0004 0x0005 0x0015 0x0016
value of MOD
KV4x Reference Manual, Rev. 2, 02/2015
Preliminary
load of CNTIN
...
...
set TOF bit
Freescale Semiconductor, Inc.

Advertisement

Table of Contents
loading

Table of Contents