#defineucharunsignedchar
#defineuintunsignedint
intcounter=0;
sbitw0=P2^7;
sbitw1=P2^6;
sbitw2=P2^5;
sbitw3=P2^4;
ucharcodetable[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71
};
voiddelay_nms(uintz)//延时子
{
uintx,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
voidDisplayShumaguan(uchar*shuzi)
{
w0=1;
w1=0;
w2=0;
w3=0;
P0=table[*shuzi];
delay_nms(40);
w0=0;
w1=1;
w2=0;
w3=0;
P0=table[*(shuzi+1)];
delay_nms(40);
w0=0;
w1=0;
w2=1;
w3=0;
P0=table[*(shuzi+2)];
delay_nms(40);
w0=0;
w1=0;
w2=0;
w3=1;
P0=table[*(shuzi+3)];
delay_nms(40);
}
voidmain()
{
ucharii[4]={1,2,3,4};
while(1)
{
DisplayShumaguan(ii);
}
}