关于数码管动态显示,为什么不能跑完接龙,到第二下就停住了
#include <reg52.h>void delay(unsigned int t)
{
while(t--)
{
unsigned char j;
for(j=0;j<125;j++);
}
}
/*unsigned char code b[]={
0x3F, //"0"
0x06, //"1"
0x5B, //"2"
0x4F, //"3"
0x66, //"4"
0x6D, //"5"
0x7D, //"6"
0x07, //"7"
0x7F, //"8"
0x6F, //"9"
0x77, //"A"
0x7C, //"B"
0x39, //"C"
0x5E, //"D"
0x79, //"E"
0x71, //"F"
0x76, //"H"
0x38, //"L"
0x37, //"n"
0x3E, //"u"
0x73, //"P"
0x5C, //"o"
0x40, //"-"
0x00, //熄灭
0x00 //自定义
};*/
unsigned char code c[]={ //weixuan
0x7f,
0xbf,
0xdf,
0xef,
0xf7,
0xfb,
0xfd,
0xfe,
};
unsigned char code d520[]={ //520
0x3f,
0x5b,
0x6d,
};
sbit we=P2^7;
sbit du=P2^6;
#define uchar unsigned char
#define uint unsigned int
void main()
{
uchar i;
uchar j;
uint t1=100;
for(j=0;j<6;j++)
{
while(t1--)
{
for(i=0;i<3;i++)
{
du=1;
P0=d520[i];
du=0;
we=1;
P0=c[(j+i)];
we=0;
delay(1);
}
}
}
}