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

📄 delay.c

📁 reading gps data from serial
💻 C
字号:
/*
*********************************************************************************************************
*									SIMPLE SOFTWARE DELAY FUNCTIONS
*
* File name		: delay.c
* Programmer 	: John Leung, TechToys. Hong Kong
* Web presence  : www.TechToys.com.hk
* Note			: 
* Language		: Keil C 7.xx 2K limited version under uVision2 IDE
* Hardware		: not specified
* Date			: Version 0.0 (30th May 2006)
*********************************************************************************************************
*											DESCRIPTION
*
* This module provides interface for simple software delay functions adjusted for external
* crystal of 11.0592MHz
*********************************************************************************************************
*/

#include <p18f452.h> /* for the special function register declarations */
#include "delay.h"

/*
*********************************************************************************************************
*                         				DELAY MICRO-SECOND FUNCTION
*
* Description : This function implements a software delay in usec. However, this is NOT an exact
*				usec delay function.
*				Timing calculation as (13*N+26)us at 11.0592MHz, (12*N+24)us at 12MHz
* Arguments   : 'N'		time to delay, (13*N+26)us, adjusted for external crystal of 11.0592MHz,
*						12 clock cycle timing
*			
* Returns     : none
*********************************************************************************************************
*/
void DelayUs(unsigned int N)
{
	unsigned int x;

	for(x=0; x<=N;x++);
}

/*
*********************************************************************************************************
*                         				DELAY MILLI-SECOND FUNCTION
*
* Description : This function implements a software delay in millisec. Parameters adjusted for an 
*				external crystal of 11.0592MHz, with mcu of 12 clock cycle		
* Arguments   :	'msec'		time to delay, roughly in millisec timing
*			
* Returns     : none
*********************************************************************************************************
*/
void DelayMs(unsigned int msec)
{
	unsigned int x,y;

	for(x=0; x<=msec;x++)
		{
			for(y=0;y<=110;y++);
		}
}

⌨️ 快捷键说明

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