发表于:2009/3/28 21:21:21
#0楼
请问下面 C 程序什么地方有错误?
谢谢!
/*ch7-1.c定时器试验1-查询方式-高低位等互上闪*/
//==================================================================
#include <reg51.h>
#define LED P2
#define count_M1 50000
#define TH _M1(65636-count_M1)/256
#define TL _M1(65636-count_M1)%256
//====================================================================
main()
{ int i;
IE=0x82;
TMOD=0x01;
LED=0xf0;
while(1)
{ for (i=0;i<5;i++)
{ TH0=TH_M1;
TL0=TL_M1;
TR0=1;
while(TF0==0);
TF0=0;
}
LED= ~LED;
}
}
谢谢!
/*ch7-1.c定时器试验1-查询方式-高低位等互上闪*/
//==================================================================
#include <reg51.h>
#define LED P2
#define count_M1 50000
#define TH _M1(65636-count_M1)/256
#define TL _M1(65636-count_M1)%256
//====================================================================
main()
{ int i;
IE=0x82;
TMOD=0x01;
LED=0xf0;
while(1)
{ for (i=0;i<5;i++)
{ TH0=TH_M1;
TL0=TL_M1;
TR0=1;
while(TF0==0);
TF0=0;
}
LED= ~LED;
}
}