?? timer.c
字號:
#include <string.h>
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\timer.h"
void __irq Wdt_Int(void);
volatile int isWdtInt;
/****************************************
* Watch-dog timer test *
****************************************/
void Test_WDTimer(void)
{
Uart_Printf("WatchDog Timer Test:\n\n");
rINTMSK=~(BIT_GLOBAL|BIT_WDT);
pISR_WDT=(unsigned)Wdt_Int;
isWdtInt=0;
rWTCON=((MCLK/1000000-1)<<8)|(3<<3)|(1<<2); // Prescaler Value=MCLK/1000000-1,Clock Select=1/128, interrupt enable
rWTDAT=8448/2;
rWTCNT=8448/2;
rWTCON=rWTCON|(1<<5); // Watchdog Timer enable
while(isWdtInt!=10);
rWTCON=((MCLK/1000000-1)<<8)|(3<<3)|(1); // reset enable
Uart_Printf("\nI will restart after 3 sec!!!\n");
rWTCNT=8448*3;
rWTCON=rWTCON|(1<<5); // Watchdog Timer enable
while(1);
rINTMSK|=BIT_GLOBAL;
}
void __irq Wdt_Int(void)
{
rI_ISPC=BIT_WDT;
Uart_Printf("%d ",++isWdtInt);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -