FL2440下的看门狗实验

来源:互联网 发布:结构力学分析软件 编辑:程序博客网 时间:2024/05/18 03:36

//看门狗的复位功能,超时没有喂狗会引起复位
#include "2440addr.h"
void watchdog_test(void) ;
extern void Uart_Printf(char *fmt,...);
extern void Uart_Init(int baud);
void wtMain(void)
{
 Uart_Init(115200);
 Uart_Printf("watchdog test is beginning/n");  
 watchdog_test();
}

 

void watchdog_test(void)
{
  
  rWTCON=((prescaler_value<<8)|(clock_select<<3)); 
  rWTDAT=15000;
  rWTCNT=15000;
  rWTCON &= ~(3<<1);
  rWTCON|=((1<<5)|(1<<0));
  while(1);
  }

原创粉丝点击