?? led.c
字號:
#include "pin.h"
/****************************************************************************
* 名稱:DelayNS()
* 功能:長軟件延時(shí)
* 入口參數(shù):dly 延時(shí)參數(shù),值越大,延時(shí)越久
* 出口參數(shù):無
****************************************************************************/
static void DelayNS(uint32 dly)
{ uint32 i;
for(; dly>0; dly--)
for(i=0; i<50000; i++);
}
void LedLight(int LedNum,int Status)
{
SetPinMode(10+LedNum-1,0,0);
if(LedNum>4)
return;
if(Status==1)
ClrPin(9+LedNum);
else
SetPin(9+LedNum);
}
void LedFlash(int LedNum,int FlashNum)
{
while(FlashNum--)
{
LedLight(LedNum,1);
DelayNS(50);
LedLight(LedNum,0);
DelayNS(50);
}
}
void Beep(int Num)
{
SetPinMode(7,0,0);
while(Num--)
{
ClrPin(7);
DelayNS(20);
SetPin(7);
DelayNS(20);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -