CHAPTER 6 16-BIT TIMER/EVENT COUNTER P (TMP)
User’s Manual U16896EJ2V0UD
206
(2) Operation timing in free-running timer mode
(a) Interval operation with compare register
When 16-bit timer/event counter P is used as an interval timer with the TP0CCRa register used as a
compare register, software processing is necessary for setting a comparison value to generate the next
interrupt request signal each time the INTTP0CCa signal has been detected.
FFFFH
16-bit counter
0000H
TP0CE bit
TP0CCR0 register
INTTP0CC0 signal
TOP00 pin output
TP0CCR1 register
INTTP0CC1 signal
TOP01 pin output
D
00
D
01
D
02
D
03
D
04
D
05
D
10
D
00
D
11
D
01
D
12
D
04
D
13
D
02
D
03
D
11
D
10
D
12
D
13
D
14
Interval period
(D
10
+ 1)
Interval period
(
D
11
−
D
10
)
Interval period
(
D
12
−
D
11
)
Interval period
(
D
13
−
D
12
)
Interval period
(D
00
+ 1)
Interval period
(
D
01
−
D
00
)
Interval period
(D
02
−
D
01
)
Interval period
(
D
03
−
D
02
)
Interval period
(
D
04
−
D
03
)
When performing an interval operation in the free-running timer mode, two intervals can be set with one
channel.
To perform the interval operation, the value of the corresponding TP0CCRa register must be re-set in the
interrupt servicing that is executed when the INTTP0CCa signal is detected.
The set value for re-setting the TP0CCRa register can be calculated by the following expression, where
“D
a
” is the interval period.
Compare register default value: D
a
−
1
Value set to compare register second and subsequent time: Previous set value + D
a
(If the calculation result is greater than FFFFH, subtract 10000H from the result and set this value to the
register.)
Remark
a = 0, 1