
Rev. 1.21
6�
�ove��e� ��� 2�1�
Rev. 1.21
61
�ove��e� ��� 2�1�
HT66F488/HT66F489
A/D Flash MCU with EEPROM
HT66F488/HT66F489
A/D Flash MCU with EEPROM
TM Operation
The three different types of TMs 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
x
TnCK2~
x
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
TBC
clock source or the external
x
TCKn pin. The
x
TCKn pin clock source is used to
allow an external signal to drive the TM as an external clock source or for event counting.
TM Interrupts
The Compact, Standard and Periodic type TMs each has two internal interrupts, the internal
comparator A or comparator P, which generate a TM interrupt when a compare match condition
occurs. When a TM interrupt is generated, it can be used to clear the counter and also to change the
state of the TM output pin.
TM External Pins
Each of the TMs, irrespective of what type, has one TM input pin, with the label xTCKn. The TM
input pin, is essentially a clock source for the TM and is selected using the xTnCK2~xTnCK0 bits
in the xTMnC0 register. This external TM input pin allows an external clock source to drive the
internal TM. This external TM input pin is shared with other functions but will be connected to the
internal TM if selected using the xTnCK2~xTnCK0 bits. The TM input pin can be chosen to have
either a rising or falling active edge.
The TMs each have one output pin. When the TM is in the Compare Match Output Mode, these pins
can be controlled by the TM to switch to a high or low level or to toggle when a compare match
situation occurs. The external xTPn output pin is also the pin where the TM generates the PWM
output waveform. As the TM output pins are pin-shared with other function, the TM output function
must first be setup using registers. A single bit in one of the registers determines if its associated pin
is to be used as an external TM output pin or if it is to have another function. The number of output
pins for each TM type is different, the details are provided in the accompanying table.
Pin
TM Type
Input
Output
CTM
CTM
CTCK
CTP
STM
STM
STCK
STP
PTM
PTM�
PTCK�
PTP�
PTM1
PTCK1
PTP1
TM Input/Output pin