
void Timer1Mode3Init()
{
TH1 = 0xF8; //(65536 - 2000) / 256; set 2ms interrupt
TL1 = 0x30; //(65536 - 2000) % 256;

ET1 = 1; //timer1 overflow interrupt
TMOD |= 0x10 ; // timer1,mode 3
TR1 = 1; // timer 1 start
}
//==================================================================================
//
// name : Timer1 Interrupt
//
// function :
// -
//
//==================================================================================
void timer1(void) interrupt 3 //Timer1 interrupt 3
{
ET1 = 0;
TH1 = 0xF8; //(65536 - 2000) / 256; set 2ms interrupt
TL1 = 0x30; //(65536 - 2000) % 256;
LEDCount++;
ET1 = 1;
}
在中断里面没有重新设置装载TH1 TL1的值,在时间上进入的中断时间差33倍,为66ms,有点吓人。

售后响应及时
7×24小时客服热线
数据备份
更安全、更高效、更稳定
价格公道精准
项目经理精准报价不弄虚作假
合作无风险
重合同讲信誉,无效全额退款