case E_BUTTON2:
if(two_button == S_OFF)
{
TIM3->ARR-=10;
speed=360000/(TIM3->ARR+1);
LCD_DisNum(100,200, speed , BLACK);
LCD_DispStr(130,200, (uint8_t *)"RPM " , BLACK);
five_button = S_ON;
}
else
{
TIM3->ARR-=10;
speed=360000/(TIM3->ARR+1);
LCD_DisNum(100,200, speed , BLACK);
LCD_DispStr(130,200, (uint8_t *)"RPM " , BLACK);
two_button = S_OFF;
}
even = E_NULL;
break;
}
上面程序是希望按2键,数值增大,电机转的越来越快才对!!!!可实际上是一直按键,到一段时间后电机反而转慢了,过会又转快了????????这到底咋回事啊!!!!!!!!!!!! |