发布网友 发布时间:2024-10-11 08:23
共1个回答
热心网友 时间:2024-11-23 18:34
两个if语句改为while语句,并将下面的TR0=0;改成,TF0=0;
修改如下:
#include<reg51.h>
unsigned char LedChar[]={
0xc0,0xf9,0xa4,0xb4,0x99,0x92,0x82,0xf8,
0x80
};
void main()
{
TMOD=0x01;
TH0=0xd8;
TL0=0xf0;
TR0=1;
while(1)
{
while(TF0==0);
TF0=0;
TH0=0xd8;
TL0=0xf0;
P2=0x80;
P0=LedChar[6];
while(TF0==0);
TF0=0;
TH0=0xd8;
TL0=0xf0;
P2=0x40;
P0=LedChar[0];
}
}
仿真效果如下