TR1 = 0;
TH1 = (65536-50000)/256;
TL1 = (65536-50000)%256;
TR1 = 1; //启动定时器T1
if(start == 1)
{
Time1onecnt ++;
if(Time1onecnt <= (PWM*18))
{//(j)s
drive = 1; //亮
}
else
{
drive = 0; //暗
}
if(Time1onecnt == 1080)
{//60s
Time1onecnt = 0;
}
在该程序中,T1的定时时间为55ms,而不是50ms,请问是什么原因?在将20/1200改为18/1080的时候,整个定时中断还是存在着1S的误差,请问如何解决? |