Up Counting - NXP Semiconductors MC9S08SU16 Reference Manual

Table of Contents

Advertisement

19.5.3.1 Up counting

Up counting is selected when (CPWMS = 0).
The starting value of the count is 0x0000 and MODH:L defines the final value of the
count; see the following figure. The value of 0x0000 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 0x0000.
The FTM period when using up counting is (MODH:L + 0x0001) × period of the FTM
counter clock.
The TOF bit is set when the FTM counter changes from MODH:L to 0x0000.
FTM counting is up (CPWMS = 0)
MODH:L = 0x0004
3
4
FTM counter
TOF bit
period of FTM counter clock
period of counting = (MODH:L + 0x0001) x period of FTM counter clock
19.5.3.2 Up-down counting
Up-down counting is selected when (CPWMS = 1).
The starting value of the count is 0x0000 and MODH:L defines the final value of the
count. The value of 0x0000 is loaded into the FTM counter, and the counter increments
until the value of MODH:L is reached, at which point the counter is decremented until it
returns to the value of 0x0000 and the up-down counting restarts.
The FTM period when using up-down counting is 2 × (MODH:L) × period of the FTM
counter clock.
The TOF bit is set when the FTM counter changes from MODH:L to (MODH:L – 1).
NXP Semiconductors
0
1
2
3
set TOF bit
Figure 19-4. Example of FTM up counting
MC9S08SU16 Reference Manual, Rev. 5, 4/2017
Chapter 19 FlexTimer Module (FTM)
4
0
1
2
set TOF bit
0
3
4
1
set TOF bit
2
331

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mc9s08su16vfkMc9s08su8vfk

Table of Contents