NEC 78GK0S/K 1+ Series Application Note page 31

Sample program (watchdog timer) 131 ms interval runaway detection
Table of Contents

Advertisement

In that case, LED1 blinks every 120 ms even if SW is turned on.
<RESET source and LED2>
+------------------------+
|
RESET Source
|
|----------------|-------|
| Other than WDT |
|----------------|-------|
| WDT
+------------------------+
<<I/O port settings>>
Input: P43
Output: P00-P03, P20-P23, P30-P33, P40-P42, P44-P47, P120-P123, P130
# All unused ports are set as the output mode.
*****************************************************************************/
/*============================================================================
Preprocessing directive (#pragma)
============================================================================*/
#pragma
SFR
source level */
#pragma
EI
C source level */
#pragma
NOP
the C source level */
#pragma interrupt INTP1 fn_intp1
/*****************************************************************************
Initialization after RESET
*****************************************************************************/
sreg unsigned char ucRESF;
(high-speed internal RAM area) */
void hdwinit(void){
unsigned char ucCnt200us;
/*----------------------------------------------------------------------------
Detect low-voltage + initialize the watchdog timer + set the clock
----------------------------------------------------------------------------*/
/* Initialize the watchdog timer */
WDTM
= 0b01101111;
*/
/* Set the clock <1> */
PCC
= 0b00000000;
fxp (= fx/4 = 2 MHz) */
APPENDIX A PROGRAM LIST
|
LED2 |
| (P21) |
OFF
|
|
ON
|
/* SFR names can be described at the C
/* EI instructions can be described at the
/* NOP instructions can be described at
/* Interrupt function declaration:INTP1 */
/* 8-bit variable for reset source check
/* 8-bit variable for 200 us wait */
/* WDT overflow time = 2^20/fx = 131.07 ms
/* The clock supplied to the CPU (fcpu) =
Application Note U18847EJ1V0AN
31

Advertisement

Table of Contents
loading

This manual is also suitable for:

78k0s/ka1+78k0s/kb1+78k0s/ku1+78k0s/ky1+

Table of Contents