#include <reg51.h>//写入单片机预处理{定义了特殊处理器名称}
#include <intrins.h>//51头文件
unsigned char code i[9]={0xf8,0xc7,0x3e,0xf1,0x8f,0x7c,0x7c,0xe3,0x1f};//依次移动3个单位数组
unsigned char code d[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//P0口单个点亮
unsigned char code c[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//P3口倒起点亮
unsigned char code b[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf};//P1口顺亮
unsigned char code z[]={0xbf,0xdf,0xef,0xf7,0xfb,0xfd};//P2口倒亮
unsigned char code hua[]={0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff,0xe7,0xc3,0x81,0x00,0x81,0xc3,0xe7,0xff,
0xaa,0x55,0x18,0xff,0xf0,0x0f,0x00,0xff,0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x3f,0x7f,
0x7f,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xff,0x00,0x00,0xff,0xff,0x0f,0xf0,0xff,
0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,
0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,
0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff };//花式闪烁
unsigned char code shi[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f,0xff,
0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff,0xe7,0xc3,0x81,0x00,0x81,0xc3,0xe7,0xff,
0xaa,0x55,0x18,0xff,0xf0,0x0f,0x00,0xff,0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x3f,0x7f,
0x7f,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xff,0x00,0x00,0xff,0xff,0x0f,0xf0,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,
0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,
0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff };//花式闪烁
void Delay100ms() //@11.0592MHz
{
unsigned char i, l, k;
_nop_();
_nop_();
i = 2;
l = 3;
k = 4;
do
{
do
{
while (--k);
} while (--l);
} while (--i);
}//100ms延时
void main()
{
unsigned char a,j,u;
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
for(j=0;j<=0;j--)
{
for(a=0;a<=8;a++)
{
P0=P0<<1;
Delay100ms();
P1=P1<<1;
Delay100ms();
P2=P2<<1;
Delay100ms();
P3=P3<<1;
Delay100ms();
}
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
for(u=0;u<=8;u++)
{
P0=0x00;
Delay100ms();
P0=0xff;
Delay100ms();
P1=0x00;
Delay100ms();
P1=0xff;
Delay100ms();
P2=0x00;
Delay100ms();
P2=0xff;
Delay100ms();
P3=0x00;
Delay100ms();
P3=0xff;
Delay100ms();
}
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
for(a=0;a<=8;a++)
{
P0=i[a];
Delay100ms();
P1=i[a];
Delay100ms();
P2=i[a];
Delay100ms();
P3=i[a];
Delay100ms();
}
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
for(a=0;a<=8;a++)
{
P0=d[a];
Delay100ms();
}
P0=0xff;
Delay100ms();
P1=0x7f;
Delay100ms();
P1=0xff;
Delay100ms();
P2=0x7f;
Delay100ms();
P2=0xff;
Delay100ms();
for(a=0;a<=8;a++)
{
P3=c[a];
Delay100ms();
}
P3=0xff;
Delay100ms();
P2=0xfe;
Delay100ms();
P2=0xff;
Delay100ms();
for(a=0;a<7;a++)
{
P1=b[a];
Delay100ms();
}
for(a=0;a<=6;a++)
{
P2=z[a];
Delay100ms();
}
for(a=0;a<=136;a++)
{
P0=hua[a];
P1=hua[a];
Delay100ms();
P2=shi[a];
P3=shi[a];
}
}
}
|