PID控制电机 #include"msp430x54xA.h" #include"public.h" longintnum0=0,num1=0,speed=0; intError,Error1,Error2; externucharPoint_Speed; /*=====================初始化PID==================*/ voidInit_PID(ucharpwm,uintspeed0) { while(1) { keyscan(); PWM(pwm,100-pwm);