?? delay.h
字號:
#ifndef _delay_h_
#define _delay_h_
#include<reg52.h>
#include<intrins.h>
/**************************************************************
精確延時 1 ms XALT:11.0592M
***************************************************************/
void Delay1Ms(void)
{
unsigned char i=131;
while(i!=0)
{
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
i--;
}
}
/**************************************************************
精確延時 N ms XALT:11.0592M
***************************************************************/
void DelayMs(unsigned int Delay)
{
unsigned int i;
for (i=Delay; i!=0; i--)
{
Delay1Ms();
}
}
/**************************************************************
精確延時 50us XALT:11.0592M
***************************************************************/
/*void delay50us(unsigned char Delay)
{
unsigned char i, j;
for (j=Delay; j; j--)
{
for (i=15; i; i--);
}
_nop_();
}
/**************************************************************
精確延時 1 us XALT:12M
***************************************************************/
/*void Delay1Us(void)
{
_nop_();
}
/**************************************************************
精確延時 N us XALT:12M
***************************************************************/
/*void DelayUs(unsigned int Delay)
{
unsigned int i;
for (i=Delay; i!=0; i--)
{
Delay1Us();
}
}
/**************************************************************
精確延時 1 ms XALT:12M
***************************************************************/
/*void Delay1Ms(void)
{
unsigned char i;
_nop_();
_nop_();
for (i=248; i!=0; i--)
{
_nop_();
_nop_();
}
}
/**************************************************************
精確延時 N ms XALT:12M
***************************************************************/
/*void DelayMs(unsigned int Delay)
{
unsigned int i;
for (i=Delay; i!=0; i--)
{
Delay1ms();
}
}*/
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -