HT46R01/HT46R02/HT46R03
D
a
t
a
B
u
s
R
e
l
o
a
d
P
r
e
l
o
a
d
R
e
g
i
s
t
e
r
T
1
M
1
T
1
M
0
M
S
Y
S
U
R
T
C
O
s
c
i
l
l
a
t
o
r
O
v
e
r
f
l
o
w
X
T
i
m
e
r
/
E
v
e
n
t
C
o
u
n
t
e
r
T
i
m
e
r
/
E
v
e
n
t
C
o
u
n
t
e
r
t
P
o
I
n
t
e
r
r
u
p
t
M
o
d
e
C
o
n
t
r
o
l
T
1
S
T
1
O
N
¸
2
F
D
T
M
R
1
T
1
E
8-bit Timer/Event Counter 1 Structure - HT46R02 and HT46R03
is written to their preload registers, this data will be im-
mediately written into the actual counter. However, if the
counter is enabled and counting, any new data written
into the preload data registers during this period will re-
main in the preload registers and will only be written into
the actual counter the next time an overflow occurs.
Timer Registers - TMR0, TMR1
The timer registers are special function registers located
in the Special Purpose Data Memory and is the place
where the actual timer value is stored. These registers
are known as TMR0 or TMR1, depending upon which de-
vice is used. The value in the timer registers increases by
one each time an internal clock pulse is received or an
external transition occurs on the external timer pin. The
timer will count from the initial value loaded by the
preload register to the full count of FFH at which point the
timer overflows and an internal interrupt signal is gener-
ated. The timer value will then be reset with the initial
preload register value and continue counting.
Timer Control Registers - TMR0C, TMR1C
The flexible features of the Holtek microcontroller
Timer/Event Counters enable them to operate in three
different modes, the options of which are determined by
the contents of their respective control register.
For devices with only one timer, the single Timer Control
Register is known as TMR0C while for devices with
more than one timer, there are two Timer Control Regis-
ters, known as TMR0C and TMR1C. It is the Timer Con-
trol Register together with its corresponding timer
registers that control the full operation of the
Note that to achieve a maximum full range count of FFH,
the preload register must first be cleared to all zeros. It
should be noted that after power-on, the preload regis-
ters will be in an unknown condition. Note that if the
Timer/Event Counters are in an OFF condition and data
b
0
b
7
T
i
m
e
r
/
E
v
e
n
t
C
o
u
n
t
e
r
C
o
n
t
r
o
l
R
e
g
i
s
t
e
r
T
0
M
1
T
0
M
0
T
0
S
T
0
O
N
T
0
E
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