?? profile.c
字號(hào):
/*********************************************************************************************
* File: main.c
* Author: embest
* Desc: c main entry
* History:
* J.Y.Guo, Programming start, March 12, 2005
*********************************************************************************************/
/*------------------------------------------------------------------------------------------*/
/* include files */
/*------------------------------------------------------------------------------------------*/
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include "2410lib.h"
/*------------------------------------------------------------------------------------------*/
/* global variables */
/*------------------------------------------------------------------------------------------*/
static int f_nCount;
/*------------------------------------------------------------------------------------------*/
/* function declare */
/*------------------------------------------------------------------------------------------*/
void wdt_int(void) __attribute__ ((interrupt ("IRQ")));
/*********************************************************************************************
* name: timer_initex
* func: timer operation
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void timer_initex(void)
{
f_nCount = 0;
pISR_WDT = (UINT32T)wdt_int;
ClearPending(BIT_WDT);
rINTMSK &= ~(BIT_WDT);
}
void timer_startex(void)
{
int divider = 0;
rWTCON = ((PCLK/1000000-1)<<8)|(0<<3)|(1<<2); // 16us
rWTDAT = 0xffff;
rWTCNT = 0xffff;
// 1/16/(65+1),interrupt enable,reset disable,watchdog enable
rWTCON = ((PCLK/1000000-1)<<8)|(0<<3)|(1<<2)|(0<<0)|(1<<5);
}
float timer_stopex(void)
{
int count;
rWTCON = ((PCLK/1000000-1)<<8);
rINTMSK |= BIT_WDT;
count = (0xffff-rWTCNT)+(f_nCount*0xffff);
return ((float)count*(16e-6));
}
/*********************************************************************************************
* name: wdt_int
* func: watch dog interrupt handler
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void wdt_int(void)
{
ClearPending(BIT_WDT);
f_nCount++;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -