这个中断程序中的count不能赋值,只要赋值给它就会死在中断里,请问各位前辈这是为什么?谢谢!甚急!!
void tm0(void tm0() interrupt 1
{
static int i=0;
ET0=0;
count=speed_temp;
if(flag_open==1)
{
HIGHDUTY=speed_up
;
LOWDUTY=HIGHDUTY;
if(HIGHDUTY==speed_up[count])
{
HIGHDUTY=speed_up[count];
LOWDUTY=HIGHDUTY;
}
if(time==10)
{
time=0;
if(i<count)
i++;
if(i>count)i--;
}
}
if(flag_open==0)
{
HIGHDUTY=speed_up;
LOWDUTY=HIGHDUTY;
if(time==4)
{
time=0;
if(i>0)
{
i--;
}
else
flag_off=1;
}
}
flag = !flag;
if (flag)
{
TL0 = (65526-HIGHDUTY);
TH0 = (65536-HIGHDUTY) >> 8;
}
else
{
TL0 = (65536-LOWDUTY);
TH0 = (65536-LOWDUTY) >> 8;
}
time++;
ET0=1;
}
此帖出自
小平头技术问答
一周热门 更多>