void GetMotorPulse(void) { unsigned int nLeftPulse, nRightPulse; COUNTER1_GetNumEvents(&nLeftPulse); COUNTER2_GetNumEvents(&nRightPulse); COUNTER1_Reset(); COUNTER2_Reset(); g_nLeftMotorPulse = (int)nLeftPulse; g_nRightMotorPulse = (int)nRightPulse; if(!MOTOR_LEFT_SPEED_POSITIVE) g_nLeftMotorPulse = -g_nLeftMotorPulse; if(!MOTOR_RIGHT_SPEED_POSITIVE) g_nRightMotorPulse = -g_nRightMotorPulse; g_nLeftMotorPulseSigma += g_nLeftMotorPulse; g_nRightMotorPulseSigma += g_nRightMotorPulse; } 上面代码g_nLeftMotorPulseSigma 会不会饱和啊。。。。有点不懂。。。。坐等回复 |
欢迎光临 智能车制作 (http://111.231.132.190/) | Powered by Discuz! X3.2 |