?? delay.c
字號:
// Delay function for 8051 system (Fosc = 8MHz)
// Delay microsecond less than 255us
void DelayUs(uint8 Tus)
{
// If Tus >= 18, the delay is precise, otherwise not!
if (Tus > 17)
{
Tus = Tus/2 - 9;
if (Tus != 0)
while(--Tus != 0);
}
}
// Delay Tms ms
void DelayMs(uint16 Tms)
{
uint8 i;
while(Tms-- != 0)
{
i = 4;
while(i-- != 0)
DelayUs(250);
}
}
// Delay 4us
void delay4us(void)
{
// 4us delay
}
// Delay 100ms
void delay100ms(void)
{
DelayMs(100);
}
// Delay 500ms
void delay500ms(void)
{
DelayMs(500);
}
// Delay 1s
void delay1s(void)
{
DelayMs(1000);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -