uchar PIT_cnt=0;
int AD_number=20,left=0,right=128,zhongxian=64,zhongxianold=0,zuobian=19,youbian=110;
char dty3,dty4,dty6;
uchar dty11=0,dty21=0,yz=3,zuo=0,you=0,tb=0,m=0,n=0,shizi=0,qidian=0;
float dty5=0,dty7=0,D=0,D_last=0;
int t1=0,t2=0,t3=0;
float PID1_P=7;
float PID1_D=80;
float P_speed=1.9;
float I_speed=2.3;
int E1,E2,E3;
float Up,Ud;
float carspeed_error=0;//電機(jī)轉(zhuǎn)速與給定轉(zhuǎn)速誤差
float carspeed_now=0;
float speed_other=140;
float CarSpeedUse=170;
int carspeed_flag;
int CarSpeed_give=0;//速度PWM輸入
int dtysu;
int carspeed_time0=0;
int carspeed_time1=0;
int carspeed_time2=0;
int stop_flage=0;
float P=5;
float I=3;
float dty=0; // 變量
word AD_CAIJI[1]=0; //采集的AD數(shù)值臨時(shí)存放數(shù)組
word AD_QIUHE[1]=0; //求和臨時(shí)存放數(shù)組
word AD_JUNZHI[1]=0; //平均值