Rev. 1.10
60
November 26, 2019
Rev. 1.10
61
November 26, 2019
HT68FB240
USB Low Speed 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, Compare Match 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 two TMs having a reference name of TM0 and TM1. The
TM
s can be
categorised as Compact Type TM. The main features of
C
TMs are summarised in the
accompanying
table.
Function
CTM
Timer/Counter
√
Compare Match Output
√
PWM Channels
1
PWM Alignment
Edge
PWM Adjustment Period & Duty
Duty or Period
This chip contains a specific number of Compact Type TM unit which is shown in the table together
with their individual reference names, TM0~TM
1.
Device
TM0
TM1
HT68FB240
10-bit CTM
10-bit CTM
TM Name/Type Reference
TM Operation
The TM offers 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 TnCK2~TnCK0 bits in the TM
control registers. The clock source can be a ratio of either the system clock f
SYS
or the internal high
clock f
H
, the f
LIRC
clock source or the external TCKn pin. Note that setting these bits to the value 101
will select a reserved clock input, in effect disconnecting 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.