//模拟串口LED6位显示已通过试验!
#include<reg51.h>
#include<stdio.h>
sbit P1_0=P1^0;
sbit P1_1=P1^1;
sbit P1_4=P1^4;
unsigned char a=0,b=0,c=0,d=0,e=0,f=0;
unsigned char x[]={0x03,0x9f,0x25,0x0d,0x99,0x49,0x41,0x1f,0x01,0x09};
delay()
{
int l;
char m;
for (l=0;l<5000;l++)
for (m=0;m<10;m++);
}
shushu()
{
a=a++;
if(a==10)
{ a=0;
b=++b;
}
if(b==10)
{ b=0;
c=++c;
}
if(c==10)
{ c=0;
d=++d;
}
if(d==10)
{ d=0;
e=++e;
}
if(e==10)
{ e=0;
f=++f;
}
if(f==10)
{ f=0;
}
}
main()
{
while(1)
{
unsigned char y,z;
shushu();
for (y=0;y<=7;y++)
{z=x[a]>>y;
P1_0=z&0x01;
P1_1=0;
P1_1=1;
}
for (y=0;y<=7;y++)
{z=x[b]>>y;
P1_0=z&0x01;
P1_1=0;
P1_1=1;
}
for (y=0;y<=7;y++)
{z=x[c]>>y;
P1_0=z&0x01;
P1_1=0;
P1_1=1;
}
for (y=0;y<=7;y++)
{z=x[d]>>y;
P1_0=z&0x01;
P1_1=0;
P1_1=1;
}
for (y=0;y<=7;y++)
{z=x[e]>>y;
P1_0=z&0x01;
P1_1=0;
P1_1=1;
}
for (y=0;y<=7;y++)
{z=x[f]>>y;
P1_0=z&0x01;
P1_1=0;
P1_1=1;
}
P1_4=0;
P1_4=1;
delay();
}
}