標題: 點亮LED的簡單51單片機程序 [打印本頁]

作者: 杰哥...    時間: 2016-12-7 20:42
標題: 點亮LED的簡單51單片機程序
#include<reg51.h>

sbit LED1=P2^0;
void Delay(unsigned int a);
void main()
{
        while(1)
        {
                LED1=0;//μãáá
                Delay(5000);
                LED1=1;
                Delay(5000);
        }
}

void Delay(unsigned int a)//0~65535
{
        unsigned char b;
        for(;a>0;a--)
        {
                for(b=110;b>0;b--);
        }
}






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1