单片机:跑马灯程序源代码 易理解

#include<reg51.h>
#include <intrins.h>
char LED;
void delay(unsigned int i)
{
    unsigned char j;
    for(i; i > 0; i--)
        for(j = 255; j > 0; j--);

}
 main()
{
    unsigned char LED;
    unsigned int i;
    LED = 0xfe;
    P1 = LED;
    while(1)
    {
        delay(250);
        if (LED==0Xfe)
            {
                for (i=1;i<=7;i++)
                    {
                        LED = _crol_(LED,1);
                        delay(250);        
                        P1 = LED;
                    }    
            }
    if (LED==0X7F)
    {
        for (i=1;i<=7;i++)
            {
                LED=_cror_(LED,1);
                delay(250);
                P1 = LED;
            }
    }
    }
}

 

单片机:跑马灯程序源代码 易理解

上一篇:Redis常用命令


下一篇:MySQL5.6 Replication主从复制(读写分离) 配置完整版