HT95LXXX
Rev. 1.20
20
May 26, 2004
Timer/Event Counter
Two timer/event counters (TMR0, TMR1) are imple-
mented in the telephone controller series. The
Timer/Event Counter 0 and Timer/Event Counter 1 con-
tain 16-bits programmable count-up counter and the
clock may come from an external or internal source. For
TMR0, the internal source is the instruction clock (sys-
temclock/4).ForTMR1,theinternalsourceis32768Hz.
Using the 32768Hz clock or instruction clock, there is
only one reference time-base. The external clock input
allows the user to count external events, measure time
intervals or pulse width, or generate an accurate time
base.
There are 3 registers related to the Timer/Event Counter
0; TMR0H, TMR0L and TMR0C. Writing TMR0L only
writes the data into a low byte buffer, but writing TMR0H
simultaneously writes the data along with the contents
of the low byte buffer into the Timer/Event Counter 0
preload register (16-bit). The Timer/Event Counter 0
preload register is changed by writing TMR0H opera-
tions. Writing TMR0L will keep the Timer/Event Counter
0 preload register unchanged.
Reading TMR0H latches the TMR0L into the low byte
buffer to avoid a false timing problem. Reading TMR0L
returns the contents of the low byte buffer. In other
words, the low byte of the Timer/Event Counter 0 can
not be read directly. It must read the TMR0H first to
make the low byte contents of Timer/Event Counter 0 be
latched into the buffer.
There are 3 registers related to the Timer/Event Counter
1; TMR1H, TMR1L and TMR1C. The Timer/Event
Counter 1 operates in the same manner as the
Timer/Event Counter 0.
1
$
/
" .
"
/
1 4 #
"
" $ 1
/
"
1 #
" $ 1
" 9
/
#
! / %
"
" $ B "
" /
0 " <
" /
0 1 2 =
" B " ' ( ) * + , -
% " 9
" 9
! !
D
D
B " D "
E "
$ "
"
"
" " " " " " " " " "
" !
" ,
; 6
$ $ $ 1 $ $
8
$
1
$
$ 1
$
$
1
$
1
$
$ 1
$
$ 4 1
4
Timer/Event Counter 0/1
Register
Label
Bits
R/W
Function
TMR0C
(0EH)
/
TMR1C
(11H)
0~2
RO
Unused bit, read as 0
T0E/T1E
3
RW
To define the TMR0/TMR1 active edge of timer
For event count or Timer mode
(0=active on low to high; 1=active on high to low)
For pulse width measurement mode
(0=measures low pulse width; 1=measures high pulse width)
T0ON/T1ON
4
RW
To enable/disable timer counting (0=disabled; 1=enabled)
5
RO
Unused bit, read as 0
T0M0/T1M0
T0M1/T1M1
6
7
RW
To define the operating mode
Bit 7, 6=01, Event count mode (external clock)
Bit 7, 6=10, Timer mode
Bit 7, 6=11, Pulse width measurement mode
Bit 7, 6=00, Unused
Only Timer mode is available for HT95L000/00P.
Register
Bits
R/W
Function
TMR0H (0CH)
0~7
RW
Timer/Event Counter 0 higher-order byte register
TMR0L (0DH)
0~7
RW
Timer/Event Counter 0 lower-order byte register
TMR1H (0FH)
0~7
RW
Timer/Event Counter 1 higher-order byte register
TMR1L (10H)
0~7
RW
Timer/Event Counter 1 lower-order byte register