
Rev. 1.00
3�
��ne 1�� �01�
Rev. 1.00
35
��ne 1�� �01�
HT46R003B
Cost-Effective A/D 8-bit OTP MCU
HT46R003B
Cost-Effective A/D 8-bit OTP MCU
Timer/Event Counter
The provision of timer form an important part of any microcontroller, giving the designer a means of
carrying out time related functions. The device contains from an 8-bit count-up timer. As the timer
has three different operating modes, they can be configured to operate as a general timer, an external
event counter or as a pulse width capture device. The provision of an internal prescaler to the clock
circuitry on gives added range to the timer.
There are two types of registers related to the Timer/Event Counter. The first is the register that
contains the actual value of the timer and into which an initial value can be preloaded. Reading from
this register retrieves the contents of the Timer/Event Counter. The second type of associated register
is the Timer Control Register which defines the timer options and determines how the timer is to
be used. The device can have the timer clock configured to come from the internal clock source. In
addition, the timer clock source can also be configured to come from an external timer pin.
Configuring the Timer/Event Counter Input Clock Source
The Timer/Event Counter clock source can originate from various sources, an internal clock or an
external pin. The internal clock source is used when the timer is in the timer mode. For the Timer/
Event Counter, this internal clock source is first divided by a prescaler, the division ratio of which
is conditioned by the Timer Control Register bits TPSC2~TPSC0. The internal clock source can
be derived from the system clock f
SYS
or from the instruction clock f
SYS
/4 or the internal low speed
oscillator LIRC for Timer/Event Counter selected by the clock selection bits WDTCLS1~WDTCLS0
in the register WDTC.
An external clock source is used when the Timer/Event Counter is in the event counting mode, the
clock source being provided on an external timer pin TMR. Depending upon the condition of the
TEG bit, each high to low, or low to high transition on the external timer pin will increment the
counter by one.
Clock Source for Timer/PWM/WDT/Time Base
8-bit Timer/Event Counter Structure