用定时器0时main函数中为什么要赋初值?(只在中断函数里赋初值现象好像不影响的)
2011-04-01
展开全部
Hz
#define time 50
void Time1(void)
{
TR1 = 1;
EA = 1;
TH1 = (65535 - 1000)>>8;
TL1 = 665535 - 1000;
ET0 = 1;
}
void Timer_ISR(void) intterupt 3 //1ms定时
{
static unsigned char i = 0;
TH1 = (65535 - 1000)>>8;
TL1 = 665535 - 1000;
if (++i >= time)
{
i = 0;
flag = 1;
}
}
另外,虚机团上产品团购,超级便宜
#define time 50
void Time1(void)
{
TR1 = 1;
EA = 1;
TH1 = (65535 - 1000)>>8;
TL1 = 665535 - 1000;
ET0 = 1;
}
void Timer_ISR(void) intterupt 3 //1ms定时
{
static unsigned char i = 0;
TH1 = (65535 - 1000)>>8;
TL1 = 665535 - 1000;
if (++i >= time)
{
i = 0;
flag = 1;
}
}
另外,虚机团上产品团购,超级便宜
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询