delays.c

来自「介绍了ARC4加密算法。以单片机为主控器」· C语言 代码 · 共 46 行

C
46
字号
/*****************************************************************************
*
* File: delays.c
* 
* Copyright S. Brennen Ball, 2006-2007
* 
* The author provides no guarantees, warantees, or promises, implied or
*	otherwise.  By using this software you agree to indemnify the author
* 	of any damages incurred by using it.
* 
*****************************************************************************/

//This code depends on a clock frequency of 40 MHz.

#include "delays.h"
#include <delays.h>

void DelayUS(unsigned long microseconds)
{
	unsigned long count;
	
	for(count = 0; count < microseconds; count++)
		Delay10TCY();
}

void DelayMS(unsigned long milliseconds)
{
	unsigned long count;
	
	for(count = 0; count < milliseconds; count++)
		Delay10KTCYx(1);
}

void DelayS(unsigned long seconds)
{
	unsigned long count;
	
	for(count = 0; count < seconds; count++)
	{
		Delay10KTCYx(250);
		Delay10KTCYx(250);
		Delay10KTCYx(250);
		Delay10KTCYx(250);
	}
}

⌨️ 快捷键说明

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