⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer.c

📁 s3c44b0功能测试源码
💻 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 + -