#include "reg51.h"
sbit LED =P0^0;
void main()
{
unsigned char cnt =0;
TMOD =0X01;
TH0 =0XDB;
TL0 =0XFF; //我想这个 TL0 =0XFF;(255),怎么溢出后使得 TF0 ==1的然后进入循环,好像也没什么公式让TL0自加1啊?
TR0 =1;
while(1)
{
if(1 ==TF0)
{
TF0 =0;
TH0 =0XDB;
TL0 =0XFF;
cnt++;
if(cnt>=100)
{
cnt =0;
LED = ~LED;
}
}
}
}
|