HT66F016/HT66F017/HT68F016/HT68F017
HT66F016R/HT66F017R/HT68F016R/HT68F017R
Timer Modules - TM
One of the most fundamental functions in any
microcontroller device is the ability to control and mea-
sure time. To implement time related functions each de-
vice 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 Out-
put as well as being the functional unit for the generation
of PWM signals. Each of the TMs has either two individ-
ual 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.
The common features of the different TM types are de-
scribed here with more detailed information provided in
the individual Compact, Standard and Enhanced TM
sections.
Introduction
The devices contain two TMs with each TM having a ref-
erence name of TM0 and TM1. Each individual TM can
be categorised as a certain type, namely Compact Type
TM (CTM) or Standard Type TM (STM). Although similar
in nature, the different TM types vary in their feature
complexity. The common features to all of the Compact
and Standard TMs will be described in this section and
the detailed operation regarding each of the TM types
will be described in separate sections. The main fea-
tures and differences between the two types of TMs are
summarised in the accompanying table.
TM Operation
The two 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 oper-
ates 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
TnCK2~TnCK0 bits in the TM control registers. The
clock source can be a ratio of either the system clock
fSYS or the internal high clock fH, the fTBC clock source or
the external TCKn pin. Note that setting these bits to the
value 101 will select a reserved clock input, in effect dis-
connecting the TM clock source. 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.
Function
Timer/Counter
I/P Capture
Compare Match Output
PWM Channels
Single Pulse Output
PWM Alignment
PWM Adjustment Period & Duty
CTM
Ö
¾
Ö
1
¾
Edge
Duty or Period
TM Function Summary
STM
Ö
Ö
Ö
1
1
Edge
Duty or Period
Each device in the series contains a Compact Type and/or Standard Type TM units which are shown in the table to-
gether with their individual reference name, TM0 and TM1.
Device
TM0
TM1
HT66F016, HT68F016
HT66F017, HT68F017
¾
16-bit CTM
16-bit STM
16-bit STM
TM Name/Type Reference
Rev. 1.40
50
November 22, 2016