📄 wdt.c
字号:
/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -