PID代码开源
时间:11-14 10:02
查看:2448次
下载:163次
简介:
检查了下代码。。memset(S->in_e, 0, 3u * sizeof(unsigned short int));改成这样更好些。。
void *
memset (void *s, int c, unsigned n)
{
/* Not optimized, but very portable */
unsigned char *sp = (unsigned char *)s;
if ((s != NULL) && (n > 0))
{
while (n--)
{
*sp++ = (unsigned char)c;
}
}
return s;
}
speed = lptmr_get();
lptmr_clean();
__push_pid_para_(&PID_change,need_speed - speed);
PWM = __s16_GetPluse_(&PID_change);
if( PWM > 0 )
{
PWMisZheng = 1;
vMoto
补充内容 (2014-7-7 22:25):
rBackChange(0);
vMotorForChange(__ABS(PWM));
}
else
{
PWMisZheng = 2;
vMotorForChange(0);
vMotorBackChange(__ABS(PWM));
}