#include<reg51.h>
#define A P0
#include<intrins.h>
unsigned int c,flag;
void
timer0() interrupt1;
void delay(unsigned int t);
void main()
{
char ls[]={0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
while(1)
{
char i;
for(i=0;i<9;i++)
{
A=ls[i];
delay(1000);
A=_cror_(A,1);
}
for(i=7;i>0;i--)
{
A=ls[i];
delay(1000);
A=_crol_(A,1);
}
}
}
void timer0() interrupt1
{
c--;
if(c==0)
flag=1;
}
void delay(unsigned int t)
{
TMOD=0x01;
TR0=1;
EA=1;
ET0=1;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
c=t;
flag=0;
while(flag==0);
}
一周热门 更多>