Rev. 1.00
60
��ne ��� �01�
Rev. 1.00
61
��ne ��� �01�
HT66FM5440
Brushless DC Motor A/D Flash MCU
HT66FM5440
Brushless DC Motor A/D Flash MCU
Timer Modules – TM
One of the most fundamental functions in any microcontroller device
is
the ability to control and
measure time. To implement time related functions each device includes several Timer Modules,
abbreviated to the name TM. The TMs are multi-purpose timing units and serve to provide
operations such as Timer/Counter, Input Capture, Compare Match Output and Single Pulse Output
as well as being the functional unit for the generation of PWM signals. Each of the TMs has two
individual interrupts. The addition of input and output pins for each TM ensures that users are
provided with timing units with a wide and flexible range of features.
Introduction
The device contains four TMs with each TM having a reference name of PTMn. The PTM0 and
PTM1 are 16-bit Periodic Type TMs while the PTM2 and PTM3 are 10-bit Periodic Type TMs. The
common features to the 16-bit and 10-bit Periodic TMs will be described in this section and the
detailed operation will be described in the Periodic Type TMs section. The main features of TMs are
summarised in the accompanying table.
Function
PTM
Timer/Co�nter
√
Inp�t Capt�re
√
Compare Match O�tp�t
√
PWM Channels
1
Single P�lse O�tp�t
1
PWM Alignment
Edge
PWM Adj�stment Period & D�ty
D�ty or Period
TM Function Summary
PTM0
PTM1
PTM2
PTM3
16-bit PTM
16-bit PTM
10-bit PTM
10-bit PTM
TM Name/Type Reference
TM Operation
The different types of TM offer a diverse range of functions, from simple timing operations to
PWM signal generation. The key to understanding how the TM operates is to see it in terms of
a free running counter whose value is then compared with the value of pre-programmed internal
comparators. When the free running counter has the same value as the pre-programmed comparator,
known as a compare match situation, a TM interrupt signal will be generated which can clear the
counter and perhaps also change the condition of the TM output pin. The internal TM counter is
driven by a user selectable clock source, which can be an internal clock or an external pin.
TM Clock Source
The clock source which drives the main counter in each TM can originate from various sources. The
selection of the required clock source is implemented using the PTnCK2~PTnCK0 bits in the PTMn
control registers, where "n" stands for the specific TM serial number. The clock source can be a ratio
of the system clock f
SYS
or the internal high clock f
H
, the f
SUB
clock source or the external TCKn pin.
The TCKn pin clock source is used to allow an external signal to drive the TM as an external clock
source or for event counting.