关于数码管动态显示的问题。
#include <reg52.h>void delay(unsigned int t)
{
while(t--)
{
unsigned char j;
for(j=0;j<125;j++);
}
}
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);
}
}
}
}