delay.c
来自「f340的MP3程序,通过SD卡读入解码器」· C语言 代码 · 共 60 行
C
60 行
#include "intrins.h"
#include "Delay.h"
#include "string.h"
/***********************************************************************************
* Function: Delay_us;
* Description: 延时程序, 延时时间范围: 0~65535us;
************************************************************************************/
void Delay_us(unsigned int times)
{
unsigned int i;
for (i=0; i<times; i++)
{
_nop_(); // 调用NOP,延时1us
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}
}
////////////////////////////////////////////////////////////////////////////////////
/////////////////12M不分频///延时1ms////////////////////////////////////////////////
/*void Delay(unsigned int ms)
{
unsigned int i;
while(ms--)
{
for(i = 0; i < 1000; i++);
}
}*/
void delay(unsigned int time)
{
while(time--);
}
void Delay_ms(unsigned int times)
{
unsigned int i;
for (i=0; i<times; i++)
Delay_us(1000); // 调用延时函数,延时1ms
}
/////////////////12M不分频///延时1ms////////////////////////////////////////////////
void delayms(unsigned int ms)
{
unsigned int i;
while(ms--)
{
for(i = 0; i < 1000; i++);
}
}
/***********************************************************************************/
// 文件结束
/***********************************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?