![NEC 78K0S/K 1+ Series Application Note Download Page 16](http://html.mh-extra.com/html/nec/78k0s-k-1-series/78k0s-k-1-series_application-note_249252016.webp)
CHAPTER 4 SETTING METHODS
[Example 3]
The system clock (f
X
) is used as the watchdog timer operation clock and the overflow time is set to the
minimum period (2
13
/f
X
).
WDTM
MOV WDTM, #01101000B
WDTM = 0b01101000;
Note
To use the system clock as the watchdog timer operation clock, the option byte must be used
to set to “Oscillation is stopped by software setting (LSRSTOP bit is set to 1)”. For details,
refer to
.
The WDTM register setting value is “011
01000
(bits 7, 6, and 5 must be set to 0, 1, and 1,
respectively)”.
•
Assembly language
•
C language
0 1 1
0 1 0 0 0
Overflow time setting
0 0
Operation clock selection
0 1
System
clock
(f
X
)
Note
0
2
13
/f
X
[Column]
hdwinit function and main function
To create a program in C language, the hdwinit function is called to initialize peripheral devices (SFR)
immediately after CPU reset. Initial settings, such as the watchdog timer setting and clock frequency
selection are therefore basically described in the hdwinit function.
The main function is called after calling the hdwinit function, so main processing is described in the main
function.
Do not call the hdwinit function from the main function. In this case, the hdwinit function is executed twice
and the watchdog timer setting, which is only allowed to be set once is executed twice. As a result, an
internal reset signal is generated during the second execution disabling the program to advance from the
initial setting.
For details, refer to the
CC78K0S Language User’s Manual
Processing to be executed first
under
Programming on the NEC Electronics FAQ Web page.
Application Note U18752EJ2V0AN
16