486
Chapter 14
Watch Timer (WT)
Preliminary User’s Manual U17566EE1V2UM00
14.3.2
Watch Timer start-up
The first interval after starting WT0 and WT1 until their first underflow takes at
least four additional input clock cycles. At this point in time, the values of the
counter registers WTnCNT are not correct.
After the first automatic reload of the WTnR value, the counter registers
WTnCNT hold the correct number of clock cycles since the last underflow.
In the following, the start-up procedure of WT1 is described, because of its
higher relevance from an application point of view. However, all statements
refer also to WT0.
Start-up timing
Starting WT1 correctly requires some attention in order to avoid wrong
calculation of the watch time.
If WT1 is used as an extended Watch Timer counter, two steps in the following
order are required:
• The counter has to be enabled by setting WT1CTL.WTCE = 1.
• The counter's reload register WT1R has to be set to a non-zero value.
Both actions consume a different amount of input clock cycles to become
effective, as shown in the following diagram.
Figure 14-3
WT1 start-up timing
To start the counter in a deterministic way, the above actions have to be
synchronized to the WT1 input clock, which is INTWT0UV. For that purpose it
is recommended to maintain a software counter that is increased inside the
INTWT0UV interrupt service routine. By this means, it is ensured that the
actions are performed at the correct point in time.
Setting WT1CTL.WTCE to 1 enables WT1. The write access can happen at
any time. Due to internal clock synchronization, it takes at least two complete
input clock cycles, that means two INTWT0UV intervals (WTCE validation time
0 –> 1 –> 2) to become effective. After that, WT1 is prepared to acknowledge
the reload value.
S/W counter state “2” indicates that the reload value can be written now
(WT1R > 0). This time, at least three complete input clock cycles (WTR1
validation time 3 –> 4 –> 5 –> 6) are required to take over the reload value from
WT1R to the reload buffer and to start counting. At S/W counter state 6 the
counter WT1CNT is preloaded with the WT1R contents.
INTWT0UV
WT1CTL.WTCE=1
WT1R
INTWT0UV
S/W counter
0
1
2
3
4
5
6
7
WT1R = 0
WT1R > 0
WT1 start
stopped
started
WTCE
validation
WT1R
validation
electronic components distributor