494
Chapter 14
Watch Timer (WT)
Preliminary User’s Manual U17566EE1V2UM00
14.5.1
INTWT0UV interval measurement with free-running counter
When the timer is used as a free-running counter (see register TMC00) and it
detects the valid edge of INTWT0UV, it
• copies the present counter value of register TM00 to CR000,
• generates the interrupt request INTTM00.
The valid edge (rising edge, falling edge) is specified in register PRM00. If both
edges are specified, CR000 cannot perform a capture operation.
Setup example
TMC00 = 0000 0100
B
:
Free running mode
CRC00 = 0000 0x11
B
:
CR000 as capture register with
INTWT0UV as capture signal
PRM00.ES00[1:0] = 01
B
:
Rising edge
The following figure is not to scale but illustrates the operation.
Figure 14-4
Timing in free-running mode
As shown in the figure, the interrupt INTTM00 can be used as a trigger for
reading the register CR000.
The interval duration must be calculated from the difference between the
present and the previous value of CR000.
Note
If TM00 overflows between two occurrences of INTWT0UV, that means
between two capture triggers, the overflow flag TMC00.OVF00 is set.
Therefore, check also TMC00.OVF00 when reading the second capture value
in order to calculate the interval correctly, because an overflow may happen
during the measurement.
Consider the chosen periods for INTWT0UV and of WCTCLK.
T
WCTCLK
0000
H
0000
H
FFFF
H
0001
H
D0 D0 + 1
D1
D0
D1
D2
D3
D2
D3
D1 + 1
(D1
−
D0)
×
T
WCTCLK
(D3
−
D2)
×
T
WCTCLK
(10000
H
−
D1 + D2)
×
T
WCTCLK
WCTCLK
TM00
INTWT0UV
CR000
INTTM00
OVF00
electronic components distributor