#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
sbit beep=P2^3;
void ji_ou();
void sx();
void shanshuo();
void two_out_in_out();
void four_out_in_out();
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main()
{
ji_ou();
sx();
two_out_in_out();
four_out_in_out();
shanshuo();
P1=0xff;
while(1);
}
void ji_ou()
{
uint t;
for(t=0;t<3;t++)
{
P1=0xaa;
delay(300);
P1=0x55;
delay(300);
}
}
void sx()
{
uint a,i,j;
for(j=0;j<3;j++)
{
a=0xfe;
for(i=0;i<8;i++)
{
P1=a;
//delay(200);
beep=0;
delay(50);
beep=1;
delay(50);
a=_crol_(a,1);
}
a=0x7f;
for(i=0;i<8;i++)
{
P1=a;
//delay(200);
beep=0;
delay(50);
beep=1;
delay(50);
a=_cror_(a,1);
}
}
}
void two_out_in_out()
{
uint i,j;
P1=0xff;
for(i=0;i<3;i++)
{
P1=0x7e;
delay(300);
P1=0xbd;
delay(300);
P1=0xdb;
delay(300);
P1=0xe7;
delay(300);
}
P1=0xff;
for(j=0;j<3;j++)
{
P1=0xe7;
delay(300);
P1=0xdb;
delay(300);
P1=0xbd;
delay(300);
P1=0x7e;
delay(300);
}
}
void four_out_in_out()
{
uint k;
P1=0xff;
for(k=0;k<3;k++)
{
P1=0x3c;
delay(300);
P1=0xc3;
delay(300);
}
P1=0xff;
for(k=0;k<3;k++)
{
P1=0xc3;
delay(300);
P1=0x3c;
delay(300);
}
}
void shanshuo()
{
uint k;
P1=0xff;
for(k=0;k<6;k++)
{
P1=~P1;
delay(300);
beep=0;
delay(50);
beep=1;
delay(50);
}
}