[51]跑马灯

来源:互联网 发布:疾病自测软件 编辑:程序博客网 时间:2024/05/01 01:05
#include<reg52.h>
#include <intrins.h>
#define uint unsigned int 
#define uchar unsigned char 
void delay(uint z)
{
    uint x,y;
    for(x=z;x>0;x--)
        for(y=110;y>0;y--);    
}
void main()
{
    uchar temp=0xfe;
    while(1)
    {
    P1=temp;
    temp=_crol_(temp,1);
        if(temp==0xfe)
        {    
        temp=0x7f;
            while(1)
            {
             temp=_cror_(temp,1);
             delay(200);
             P1=temp;
             if(temp==0xfe){temp=0xfe;break;}
            }
        continue;
        }
    delay(200);
    }
}

0 0
原创粉丝点击