#include <reg52.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar i;
uchar j;
uchar aa;
uchar code t[]=
{
0xc0,0xf9,0xa4,0xb0,
0x99,0x92,0x82,0xf8,
0x80,0x90
};
void delay(uint z);
void main()
{
aa=0;
TMOD=0X01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
while(1)
{
i=0xfe;
for(j=0;j<7;j++)
{
P1=i;
i=_crol_(i,1);
delay(500);
}
for(j=0;j<7;j++)
{
P1=i;
i=_cror_(i,1);
delay(500);
}
for(j=0;j<8;j++)
{
P1=i;
i<<1;
delay(500);
}
i=0x7f;
for(j=0;j<8;j++)
{
P1=i;
i>>1;
delay(500);
}
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
if(aa==20)
{
aa=0;
P2=0xf0;
for(i=0;i<10;i++)
{
P0=t[i];
delay(500);
aa++;
}
}
}
void delay(uint z)
{
while(z--)
for(i=0;i<110;i++);
} |