#include<reg52.h>
int i,j;
sbit key=P3^0;
int k;
void delay(unsigned char t) //**
{ //延
unsigned char m,n; //时
for(m=0;m<t;m++) //函
for(n=0;n<180;n++); //数
} //**
void key() //**
{ //**
if(key==0) //**
{ //**
delay(10); //**
if(key==0) //按
{ //键
k++; //检
while(!key); //测
if(k>5) //**
k=0; //**
} //**
} //**
} //**
unsigned char code tuan_1[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xd7,0xfb,0xdb,0xf7,0xdd,0xcd,0xde,0x3d,
0xd9,0x3d,0xc7,0xcb,0xfb,0xfb,0xe7,0xf7,
0x0f,0xcf,0xe8,0x3f,0xef,0x9f,0xef,0xe7,
0xeb,0xf3,0xe7,0xf9,0xef,0xfb,0xff,0xff,
0xfd,0xfd,0x7d,0xfb,0x8c,0x07,0xdf,0xfb,
0xff,0xfd,0xc0,0x1d,0xdf,0xbd,0xbf,0x7d,
0xbf,0xfd,0xc0,0x05,0xdf,0xfd,0xdf,0xbd,
0xdf,0xdd,0xc0,0x3d,0xff,0xfd,0xff,0xff,
0xfe,0xff,0xfd,0xff,0xf0,0x01,0xcb,0xff,
0x3d,0xf7,0xfb,0xcf,0xe6,0x3f,0x0f,0x7b,
0xaf,0xfd,0xe8,0x03,0xef,0xff,0xee,0xff,
0xeb,0x3f,0xc7,0xc7,0xef,0xef,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; //欢迎你
unsigned char code tuan_2[]={
0xff,0xff,0xfd,0xfe,0xbd,0xfd,0xbd,0xfb,
0xbd,0xf7,0xbd,0xef,0xbd,0x9f,0x80,0x7f,
0xbd,0xbf,0xbd,0xdf,0xbd,0xef,0xbd,0xf7,
0xbd,0xf3,0xbd,0xf9,0xfd,0xfb,0xff,0xff,
0xff,0xff,0xfd,0xfe,0xbd,0xfd,0xbd,0xfb,
0xbd,0xf7,0xbd,0xef,0xbd,0x9f,0x80,0x7f,
0xbd,0xbf,0xbd,0xdf,0xbd,0xef,0xbd,0xf7,
0xbd,0xf3,0xbd,0xf9,0xfd,0xfb,0xff,0xff,
0xf1,0xff,0xff,0xff,0x00,0x00,0xef,0xff,
0xf2,0xfe,0xee,0xfd,0xee,0xf3,0xee,0x8f,
0x00,0x7f,0xee,0x9f,0xee,0xef,0xee,0xf3,
0xe0,0xf9,0xfe,0xfc,0xfe,0xfd,0xff,0xff,
0xff,0xff,0xff,0xfb,0xfd,0xe7,0xc0,0xcf,
0xdd,0x1f,0xdd,0xb7,0xdd,0xfb,0x9d,0xfd,
0xa0,0x03,0xbd,0xff,0x3d,0xff,0x3d,0xbf,
0xbd,0xcf,0xfd,0xe3,0xff,0xf7,0xff,0xff}; //天天快乐
unsigned char code tuan_3[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0x7f,0xfe,0x7f,0xfe,0x00,0x00,
0x00,0x00,0x7f,0xfe,0x7f,0xfe,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xf1,0xff,0xe0,0xff,
0xc0,0x7f,0x80,0x3f,0x00,0x1f,0x00,0x0f,
0x00,0x07,0x80,0x03,0xc0,0x01,0xf0,0x00,
0xc0,0x01,0x80,0x03,0x00,0x07,0x00,0x0f,
0x00,0x1f,0x80,0x3f,0xc0,0x7f,0xe0,0xff,
0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0x00,0x03,0x00,0x01,
0x00,0x01,0xff,0xf8,0xff,0xf8,0xff,0xf8,
0xff,0xf8,0xff,0xf8,0xff,0xf8,0xff,0xf8,
0xff,0xf8,0x00,0x00,0x00,0x01,0x00,0x03,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};//I ? U
unsigned char code tuan_0[]={
0xff,0xff,0xff,0xff,0xe0,0x0f,0xed,0xdf,
0xed,0xdf,0xed,0xdf,0xed,0xdf,0x00,0x03,
0xed,0xdd,0xed,0xdd,0xed,0xdd,0xed,0xdd,
0xe0,0x0d,0xff,0xfd,0xff,0xf1,0xff,0xff,
0xff,0x7f,0xff,0x7f,0xbf,0x7f,0xbf,0x7f,
0xbf,0x7f,0xbf,0x7d,0xbf,0x7e,0xb8,0x01,
0xb7,0x7f,0xaf,0x7f,0x9f,0x7f,0xbf,0x7f,
0xff,0x7f,0xfe,0x7f,0xff,0x7f,0xff,0xff,
0xef,0x7f,0xef,0x7d,0xee,0xfe,0x00,0x01,
0xed,0xff,0xeb,0xfd,0xff,0xfd,0xec,0xfb,
0xed,0x37,0xed,0xcf,0x01,0xcf,0xed,0xb7,
0xec,0x7b,0xed,0xf9,0xef,0xfb,0xff,0xff,
0xf7,0xf7,0xf7,0xf7,0xf7,0xef,0xf7,0xdf,
0xf7,0xbf,0xf6,0x7f,0xf5,0xff,0x00,0x01,
0xf5,0xff,0xf6,0xff,0xb7,0x7f,0xd7,0x9f,
0xf7,0xcf,0xf7,0xe7,0xf7,0xef,0xff,0xff};//电子技术
unsigned char code tuan_4[]={
0xff,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfc,0xff,0xfe,0xff,0xff,0xff,
0xff,0x7f,0xfe,0xfd,0xf9,0xfd,0x87,0x7d,
0xf7,0x7d,0xf7,0x7d,0xf7,0x7d,0xf7,0x7d,
0x00,0x01,0xb7,0x7d,0xf7,0x7d,0xf7,0x7d,
0xe6,0x7d,0xf7,0x79,0xff,0xfd,0xff,0xff,
0xff,0xbf,0xdf,0x7f,0xde,0xff,0xdd,0xff,
0xd8,0x00,0xd3,0x6f,0xcb,0x6f,0x1b,0x6f,
0xdb,0x6b,0xdb,0x6d,0xdb,0x6c,0xd8,0x01,
0xdf,0xff,0xdf,0xff,0xdf,0xff,0xff,0xff,
0xfe,0xff,0xfd,0xff,0xf0,0x01,0xcb,0xff,
0x3d,0xf7,0xfb,0xcf,0xe6,0x3f,0x0f,0x7b,
0xaf,0xfd,0xe8,0x03,0xef,0xff,0xee,0xff,
0xeb,0x3f,0xc7,0xc7,0xef,0xef,0xff,0xff};//一生有你
unsigned char code tuan_5[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xf8,0x1f,0xe7,0xe7,0xdf,0xfb,
0xbf,0xfd,0x7f,0xfe,0x7f,0xfe,0xff,0xff,
0xff,0xef,0xc1,0xdf,0xbf,0xaf,0x7f,0xe7,
0xbf,0xf3,0xc1,0xf1,0xff,0xf1,0xff,0xf1,
0xff,0xf1,0xff,0xf1,0xff,0xf1,0xc1,0xf1,
0xbf,0xf3,0x7f,0xe7,0xbf,0xaf,0xc1,0xdf,
0xff,0xef,0xff,0xff,0x7f,0xfe,0x7f,0xfe,
0xbf,0xfd,0xdf,0xfb,0xe7,0xe7,0xf8,0x1f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};//(^-^)
void LED() //LED显示
{
for(i=0,j=1;i<=127,j<=128;i=i+2,j=j+2)
{
if(k==0)
{
P1=tuan_0[i],P3=tuan_0[j];
delay(1);
}
else if(k==1)
{
P1=tuan_1[i],P3=tuan_1[j];
delay(1);
}
else if(k==2)
{
P1=tuan_2[i],P3=tuan_2[j];
delay(1);
}
else if(k==3)
{
P1=tuan_3[i],P3=tuan_3[j];
delay(1);
}
else if(k==4)
{
P1=tuan_4[i],P3=tuan_4[j];
delay(1);
}
else if(k==5)
{
P1=tuan_5[i],P3=tuan_5[j];
delay(1);
}
}
}
void main(void) //主函数
{
while(1)
{
key();
LED();
}
}
int i,j;
sbit key=P3^0;
int k;
void delay(unsigned char t) //**
{ //延
unsigned char m,n; //时
for(m=0;m<t;m++) //函
for(n=0;n<180;n++); //数
} //**
void key() //**
{ //**
if(key==0) //**
{ //**
delay(10); //**
if(key==0) //按
{ //键
k++; //检
while(!key); //测
if(k>5) //**
k=0; //**
} //**
} //**
} //**
unsigned char code tuan_1[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xd7,0xfb,0xdb,0xf7,0xdd,0xcd,0xde,0x3d,
0xd9,0x3d,0xc7,0xcb,0xfb,0xfb,0xe7,0xf7,
0x0f,0xcf,0xe8,0x3f,0xef,0x9f,0xef,0xe7,
0xeb,0xf3,0xe7,0xf9,0xef,0xfb,0xff,0xff,
0xfd,0xfd,0x7d,0xfb,0x8c,0x07,0xdf,0xfb,
0xff,0xfd,0xc0,0x1d,0xdf,0xbd,0xbf,0x7d,
0xbf,0xfd,0xc0,0x05,0xdf,0xfd,0xdf,0xbd,
0xdf,0xdd,0xc0,0x3d,0xff,0xfd,0xff,0xff,
0xfe,0xff,0xfd,0xff,0xf0,0x01,0xcb,0xff,
0x3d,0xf7,0xfb,0xcf,0xe6,0x3f,0x0f,0x7b,
0xaf,0xfd,0xe8,0x03,0xef,0xff,0xee,0xff,
0xeb,0x3f,0xc7,0xc7,0xef,0xef,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; //欢迎你
unsigned char code tuan_2[]={
0xff,0xff,0xfd,0xfe,0xbd,0xfd,0xbd,0xfb,
0xbd,0xf7,0xbd,0xef,0xbd,0x9f,0x80,0x7f,
0xbd,0xbf,0xbd,0xdf,0xbd,0xef,0xbd,0xf7,
0xbd,0xf3,0xbd,0xf9,0xfd,0xfb,0xff,0xff,
0xff,0xff,0xfd,0xfe,0xbd,0xfd,0xbd,0xfb,
0xbd,0xf7,0xbd,0xef,0xbd,0x9f,0x80,0x7f,
0xbd,0xbf,0xbd,0xdf,0xbd,0xef,0xbd,0xf7,
0xbd,0xf3,0xbd,0xf9,0xfd,0xfb,0xff,0xff,
0xf1,0xff,0xff,0xff,0x00,0x00,0xef,0xff,
0xf2,0xfe,0xee,0xfd,0xee,0xf3,0xee,0x8f,
0x00,0x7f,0xee,0x9f,0xee,0xef,0xee,0xf3,
0xe0,0xf9,0xfe,0xfc,0xfe,0xfd,0xff,0xff,
0xff,0xff,0xff,0xfb,0xfd,0xe7,0xc0,0xcf,
0xdd,0x1f,0xdd,0xb7,0xdd,0xfb,0x9d,0xfd,
0xa0,0x03,0xbd,0xff,0x3d,0xff,0x3d,0xbf,
0xbd,0xcf,0xfd,0xe3,0xff,0xf7,0xff,0xff}; //天天快乐
unsigned char code tuan_3[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0x7f,0xfe,0x7f,0xfe,0x00,0x00,
0x00,0x00,0x7f,0xfe,0x7f,0xfe,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xf1,0xff,0xe0,0xff,
0xc0,0x7f,0x80,0x3f,0x00,0x1f,0x00,0x0f,
0x00,0x07,0x80,0x03,0xc0,0x01,0xf0,0x00,
0xc0,0x01,0x80,0x03,0x00,0x07,0x00,0x0f,
0x00,0x1f,0x80,0x3f,0xc0,0x7f,0xe0,0xff,
0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0x00,0x03,0x00,0x01,
0x00,0x01,0xff,0xf8,0xff,0xf8,0xff,0xf8,
0xff,0xf8,0xff,0xf8,0xff,0xf8,0xff,0xf8,
0xff,0xf8,0x00,0x00,0x00,0x01,0x00,0x03,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};//I ? U
unsigned char code tuan_0[]={
0xff,0xff,0xff,0xff,0xe0,0x0f,0xed,0xdf,
0xed,0xdf,0xed,0xdf,0xed,0xdf,0x00,0x03,
0xed,0xdd,0xed,0xdd,0xed,0xdd,0xed,0xdd,
0xe0,0x0d,0xff,0xfd,0xff,0xf1,0xff,0xff,
0xff,0x7f,0xff,0x7f,0xbf,0x7f,0xbf,0x7f,
0xbf,0x7f,0xbf,0x7d,0xbf,0x7e,0xb8,0x01,
0xb7,0x7f,0xaf,0x7f,0x9f,0x7f,0xbf,0x7f,
0xff,0x7f,0xfe,0x7f,0xff,0x7f,0xff,0xff,
0xef,0x7f,0xef,0x7d,0xee,0xfe,0x00,0x01,
0xed,0xff,0xeb,0xfd,0xff,0xfd,0xec,0xfb,
0xed,0x37,0xed,0xcf,0x01,0xcf,0xed,0xb7,
0xec,0x7b,0xed,0xf9,0xef,0xfb,0xff,0xff,
0xf7,0xf7,0xf7,0xf7,0xf7,0xef,0xf7,0xdf,
0xf7,0xbf,0xf6,0x7f,0xf5,0xff,0x00,0x01,
0xf5,0xff,0xf6,0xff,0xb7,0x7f,0xd7,0x9f,
0xf7,0xcf,0xf7,0xe7,0xf7,0xef,0xff,0xff};//电子技术
unsigned char code tuan_4[]={
0xff,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,
0xfe,0xff,0xfc,0xff,0xfe,0xff,0xff,0xff,
0xff,0x7f,0xfe,0xfd,0xf9,0xfd,0x87,0x7d,
0xf7,0x7d,0xf7,0x7d,0xf7,0x7d,0xf7,0x7d,
0x00,0x01,0xb7,0x7d,0xf7,0x7d,0xf7,0x7d,
0xe6,0x7d,0xf7,0x79,0xff,0xfd,0xff,0xff,
0xff,0xbf,0xdf,0x7f,0xde,0xff,0xdd,0xff,
0xd8,0x00,0xd3,0x6f,0xcb,0x6f,0x1b,0x6f,
0xdb,0x6b,0xdb,0x6d,0xdb,0x6c,0xd8,0x01,
0xdf,0xff,0xdf,0xff,0xdf,0xff,0xff,0xff,
0xfe,0xff,0xfd,0xff,0xf0,0x01,0xcb,0xff,
0x3d,0xf7,0xfb,0xcf,0xe6,0x3f,0x0f,0x7b,
0xaf,0xfd,0xe8,0x03,0xef,0xff,0xee,0xff,
0xeb,0x3f,0xc7,0xc7,0xef,0xef,0xff,0xff};//一生有你
unsigned char code tuan_5[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xf8,0x1f,0xe7,0xe7,0xdf,0xfb,
0xbf,0xfd,0x7f,0xfe,0x7f,0xfe,0xff,0xff,
0xff,0xef,0xc1,0xdf,0xbf,0xaf,0x7f,0xe7,
0xbf,0xf3,0xc1,0xf1,0xff,0xf1,0xff,0xf1,
0xff,0xf1,0xff,0xf1,0xff,0xf1,0xc1,0xf1,
0xbf,0xf3,0x7f,0xe7,0xbf,0xaf,0xc1,0xdf,
0xff,0xef,0xff,0xff,0x7f,0xfe,0x7f,0xfe,
0xbf,0xfd,0xdf,0xfb,0xe7,0xe7,0xf8,0x1f,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};//(^-^)
void LED() //LED显示
{
for(i=0,j=1;i<=127,j<=128;i=i+2,j=j+2)
{
if(k==0)
{
P1=tuan_0[i],P3=tuan_0[j];
delay(1);
}
else if(k==1)
{
P1=tuan_1[i],P3=tuan_1[j];
delay(1);
}
else if(k==2)
{
P1=tuan_2[i],P3=tuan_2[j];
delay(1);
}
else if(k==3)
{
P1=tuan_3[i],P3=tuan_3[j];
delay(1);
}
else if(k==4)
{
P1=tuan_4[i],P3=tuan_4[j];
delay(1);
}
else if(k==5)
{
P1=tuan_5[i],P3=tuan_5[j];
delay(1);
}
}
}
void main(void) //主函数
{
while(1)
{
key();
LED();
}
}