![Hitachi H8/3152 Hardware Manual Download Page 73](http://html.mh-extra.com/html/hitachi/h8-3152/h8-3152_hardware-manual_140481073.webp)
69
5.3.4
Initializing WDT
The WDT initialization procedure is described below. Figure 5.9 shows the initialization flow.
(1) Set CPUCS0 bit of SYSCR to select the CPU operating clock.
(2) Set TCWA to specify the allocation address of the reloading instruction.
(3) Set CS1 and CS0 to select the clock to be input to TCNT.
(4) Set TCNT to specify the initial value.
Cancel reset
Set TCNT
Set the CPUCS0 bit of SYSCR
START
END
Set TCWA
Set CS1 and CS0 of TCSR
Figure 5.9 WDT Initialization Flow
If the WDT is not initialized within 512 external clock cycles from reset when the CPUCS0 bit of
SYSCR is set to 0 or within 256 external clock cycles from reset when the CPUCS0 bit is set to 1,
TCNT will underflow and an UDF interrupt will occur. In this case, if register R7 (SP) has not
been set to the correct value, an illegal address will be accessed during the UDF interrupt
exception handling, and the chip enters the reset state by the security function.