HT45R35V Holtek Semiconductor Inc., HT45R35V Datasheet - Page 18

no-image

HT45R35V

Manufacturer Part Number
HT45R35V
Description
C/r To F Type 8-bit Otp Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet
Timer/Event Counter
An 8-bit timer/event counter, known as Timer/Event
Counter, is implemented in the microcontroller. The
Timer/Event Counter contains an 8-bit programmable
count-up counter whose clock may come from an exter-
nal source or from the system clock. Using the external
clock input allows the user to count external events, mea-
sure time internals or pulse widths, or generate an accu-
rate time base. Using the internal clock allows the user to
generate an accurate time base.
There are 2 registers related to the Timer/Event Coun-
ter, TMR and TMRC. Two physical registers are mapped
to the TMR location; writing to TMR places the start
value of the Timer/Event Counter in a preload register
while reading TMR retrieves the contents of the
Timer/Event Counter. The TMRC is a timer/event coun-
ter control register, which defines the timer operating
conditions.
The TM0, TM1 bits define the operating mode. The event
count mode is used to count external events, which
Rev. 1.00
Bit No.
0~2
3
4
5
6
7
TPSC0~TPSC2
Label
TON
TM0
TM1
TE
To define the prescaler stages, TPSC2, TPSC1, TPSC0=
000: f
001: f
010: f
011: f
100: f
101: f
110: f
111: f
To define the TMR active edge of the timer/event counter
(0=active on low to high; 1=active on high to low)
To enable or disable timer counting (0=disabled; 1=enabled)
Unused bit, read as 0
To define the operating mode, TM1, TM0=
01=Event count mode (external clock)
10=Timer mode (internal clock)
11=Pulse width measurement mode
00=Unused
INT
INT
INT
INT
INT
INT
INT
INT
=f
=f
=f
=f
=f
=f
=f
=f
SYS
SYS
SYS
SYS
SYS
SYS
SYS
SYS
/2
/4
/8
/16
/32
/64
/128
TMRC (0EH) Register
Timer/Event Counter
18
means the clock source comes from an external TMR
pin. The timer mode functions as a normal timer with the
clock source coming from the f
measurement mode can be used to measure the high or
low level duration of an external signal on the TMR pin.
The counting is based on the f
event counting or timer mode, once the timer/event coun-
ter starts counting, it will count from the current contents
in the Timer/Event Counter to FFH. Once overflow oc-
curs, the counter is reloaded from the Timer/Event Coun-
ter preload register and an interrupt request flag TF; bit 5
of INTC0, is generated at the same time.
In the pulse width measurement mode, with the TON
and TE bits equal to one, once the TMR pin has re-
ceived a transient from low to high, or high to low if the
TE bit is 0, it will start counting until the TMR pin returns
to its original level and resets the TON bit. The mea-
sured result will remain in the Timer/Event Counter even
if the activated transient occurs again. Therefore, only a
single shot measurement can be made. The TON bit
must be set again by software for further measurements
Function
INT
INT
clock. The pulse width
clock source. In the
January 15, 2009
HT45R35V

Related parts for HT45R35V