wdt.c

来自「英飞凌XC164CS系列单片机的源码」· C语言 代码 · 共 39 行

C
39
字号
/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
#include <reg167.h>
#include <intrins.h>

/*-----------------------------------------------------------------------------
Main C Function
-----------------------------------------------------------------------------*/
void main (void)
{
unsigned long i;

/*-----------------------------------------------
Configure the Watchdog Timer.
           ++----- Reload Value Set To 128
              +--- Divide By 2
-----------------------------------------------*/
WDTCON = 0x8001;

/*-----------------------------------------------
Loop and reset the watchdog timer each time.
-----------------------------------------------*/
for (i = 0; i < 10000; i++)
  {
  _srvwdt_ ();                  // Service the watchdog timer
  }

/*-----------------------------------------------
Stop updating the watchdog timer.  This should
cause a watchdog reset.
-----------------------------------------------*/
while (1)
  {
  }
}

/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?