#include<reg52.h>
sbit DU = P2^6;
sbit WE = P2^7;
unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,
0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00};
void main(void)
{
unsigned int i,j,k;
while(1)
{
DU = 0;
DU = 1;
P0 = 0x06;
DU = 0;
P0 = 0xff;
WE = 1;
P0=0xfe;
WE=0;
for(i=0;i<10000;i++);
DU=1;
P0=table[0];
DU=0;
P0=0xff;
WE=1;
P0=0xfd;
WE=0;
for(i=0;i<50000;i++);
for(K= 9;K>=0;K--)
{
DU = 0;
DU = 1;
P0 = table[i];
DU = 0;
P0 = 0xff;
WE = 1;
P0=0xfe;
WE=0;
for(j=0;j<50000;j++);
}
}
}
代码如上 为什么while只循环一次呢 也就是说数码管只是从10显示到0 然后就不在重复啦?为什么啊 为什么
|