wdt_test.c

来自「IARSOURCECODE是基于LPC2478嵌入式软件IAR EWARM V4」· C语言 代码 · 共 51 行

C
51
字号
/*****************************************************************************
 *   wdttest.c:  main C entry file for NXP LPC23xx/24xx Family Microprocessors
 *
 *   Copyright(C) 2006, NXP Semiconductor
 *   All rights reserved.
 *
 *   History
 *   2006.07.19  ver 1.00    Prelimnary version, first Release
 *
******************************************************************************/
#include "LPC2468.h"                        /* LPC23xx/24xx definitions */
#include "type.h"
#include "target.h"
#include "irq.h"
#include "timer.h"
#include "wdt.h"

extern volatile DWORD timer0_counter;
volatile DWORD feed_counter = 0;

/*****************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{ 	    		
  TargetResetInit();

  /*** The main Function is an endless loop ****/
  init_timer( 0, TIME_INTERVAL );     // 每10ms产生一次timer0中断
  enable_timer( 0 );

  WDTInit();

  while( 1 )
  {
      feed_counter = timer0_counter;

      if ( feed_counter > 0 )
      {
	  /* Feed the watchdog timer ,如果不喂狗则4秒后自动复位*/
	  //WDTFeed();
	  timer0_counter = 0;
	}
  }

}

/*********************************************************************************
**                            End Of File
*********************************************************************************/

⌨️ 快捷键说明

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