C51编程:我写的这个一秒显示一个数字的程序有什么问提啊?请前辈看看啊。
怎么连显示都没反映啊?
#include <reg51.h>
#include <stdio.h>
unsigned int x;
timer0 () interrupt 1 using 2
{ x++;
TH0=-46080/256;
TL0=-46080%256;
}
void main (void)
{
unsigned int s;
TMOD=0x21; /*t1工作方式2,t0工作方式1 0010,0001*/
TH1=0xfd;
TL1=0xfd;
TH0=-46080/256;
TL0=-46080%256;
PCON=0x00;
SCON=0x50;
IE=0x9a;
PT1=1;
TR1=1;
TR0=1;
x=0;
s=0;
while (1)
{ if (x>20)
{ x=0;
s++;
printf("%d\n",s);
}
}
}
发表时间:2001年11月29日11:44:00