/*******每层共阴*****/
#include<reg52.h>
# include <intrins.h>
#define ss unsigned char
#define mm unsigned int
sbit gong_yin1=P2^0 ; //最顶层
sbit gong_yin2=P2^2 ; //第三层
sbit gong_yin3=P2^1 ; //第二层
sbit gong_yin4=P2^4 ; //最底层2.3口蜂鸣器
ss di00[]={1,0,1,0,1,0,1,0,1};
ss di01[]={0,1,1,1,0,1,1,1};
ss di10[]={0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1};
ss gong_yang10[]={0x0f,0x8e,0x8c,0x88,0x80,0x00,0x00,0x00,0x10,0x11,0x60,0x40,0x00,0x20};
ss gong_yang30[]={0x00,0x00,0x08,0x88,0xc8,0xe8,0xf0,0x71,0x31,0x11,0x00,0x04,0x06,0x02};
ss gong_yang11[]={0x01,0x33,0x77,0xff,0xe0,0x00,0x00, 0x08,0xcc,0xee,0xff,0x70,0x00,0x00};
ss gong_yang31[]={0x00,0x00,0x07,0xff,0xee,0xcc,0x80, 0x00,0x00,0x0e,0xff,0x77,0x33,0x10};
ss gong_yang12[]={0x48,0x44,0x22,0x21,0x30,0xc0};
ss gong_yang32[]={0x12,0x22,0x44,0x84,0x0c,0x03};
ss gong_yang13[]={0x0f,0xf0,0x00,0x00};
ss gong_yang33[]={0x00,0x00,0x0f,0xf0};
/*********延时*********/
void delay(mm time)
{mm i,j;
for(i=0;i<time;i++)
for(j=0;j<250;j++);
}
/*********第一种:全亮并带有闪烁*********/
void display1()
{ ss a,i;
i=10;
while(i--)
for(a=0;a<2;a++)
{
gong_yin1=di00[a];
gong_yin2=di00[a+2];
gong_yin3=di00[a+4];
gong_yin4=di00[a+6];
P1=0xff;
P3=0xff;
delay(350);
}
}
main()
{
while(1)
{
display1();
}
}