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

📄 profile.c

📁 ARM开发的一些源码ARM 搜染色 v却轻轻轻
💻 C
字号:
/*********************************************************************************************
* 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 __irq wdt_int(void);

/*********************************************************************************************
* 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 __irq wdt_int(void)
{
	ClearPending(BIT_WDT);
	f_nCount++;   	
}



⌨️ 快捷键说明

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