单片机PID算法 源程序

• Z7_759960
了解作者
• 186KB
文件大小
• rar
文件格式
• 0
收藏次数
• VIP专享
资源类型
• 0
下载次数
• 2022-04-04 08:29
上传日期
/*中值滤波算法*/ for (j=0;j<N-1;j++) { for (i=0;i<N-j-1;i++) { if ( ADC_Data[i]>ADC_Data[i+1] ) { temp = ADC_Data[i]; ADC_Data[i] = ADC_Data[i+1]; ADC_Data[i+1] = temp; } } } data1 = ADC_Data[N/2] ; /**************************************************************************** * 名称：k_arithmetic() * 功能：将偏差经过一比例值后得到一个控制量 * 入口参数: 无 * 出口参数: D_new 比例后的D新值 * 说明：无 ****************************************************************************/ uint32 k_arithmetic(uint32 samplingDATA) { uint32 setpoint = 143; //设定值,15cm对应的数字量 int ek ; uint8 da_data ; int D_new; //D/A值 int D_inc; float kp=3.2,ki=0.01,kd=10; //比例值k=（D/A）max / |e|max ek = setpoint-samplingDATA; D_inc = kp*(ek-ek_1)+ki*ek+kd*(ek-2*ek_1+ek_2); D_new = D_old+D_inc ; if(D_new>255)da_data = 255; else if(D_new<0)da_data = 0; else da_data = D_new; D_old = D_new; ek_2 = ek_1; ek_1 = ek; return(da_data); }
3 液位数字PID计算机控制系统实验.rar

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/6275dd88602a7856fe11a215/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6275dd88602a7856fe11a215/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">&#23454;&#39564;<span class="_ _0"> </span><span class="ff2 sc1">3 </span>&#28082;&#20301;&#25968;&#23383;<span class="_ _0"> </span><span class="ff2 sc1">PID<span class="_ _0"> </span></span>&#25511;&#21046;&#21450;&#21442;&#25968;&#25972;&#23450;</div><div class="t m0 x2 h4 y3 ff1 fs1 fc0 sc1 ls0 ws0">&#25552;&#31034;<span class="_ _1"></span>&#65306;&#24076;<span class="_ _1"></span>&#26395;&#22823;<span class="_ _1"></span>&#23478;&#22312;<span class="_ _1"></span>&#20570;&#23454;<span class="_ _1"></span>&#39564;&#20043;<span class="_ _1"></span>&#21069;&#20180;<span class="_ _1"></span>&#32454;&#38405;<span class="_ _1"></span>&#35835;&#23454;<span class="_ _1"></span>&#39564;&#25351;<span class="_ _1"></span>&#23548;&#20070;<span class="_ _1"></span>&#65292;&#24182;<span class="_ _1"></span>&#19988;&#32534;<span class="_ _1"></span>&#20889;&#19977;<span class="_ _1"></span>&#20010;&#31243;<span class="_ _1"></span>&#24207;&#65288;<span class="_ _2"></span><span class="sc0">P&#12289;<span class="_ _1"></span>PI<span class="_ _1"></span>&#12289;PID<span class="_ _1"></span></span>&#65289;&#20105;</div><div class="t m0 x3 h4 y4 ff1 fs1 fc0 sc1 ls0 ws0">&#21462;&#33021;&#22815;&#21040;&#23454;&#39564;&#23460;&#23601;&#36827;&#34892;&#35843;&#33410;&#65292;&#35266;&#23519;&#25928;&#26524;&#65292;&#36827;&#34892;&#25972;&#23450;&#21442;&#25968;&#12290;</div><div class="t m0 x4 h5 y5 ff1 fs2 fc0 sc0 ls0 ws0">&#19968;&#12289;&#23454;&#39564;&#30446;&#30340;</div><div class="t m0 x2 h4 y6 ff1 fs1 fc0 sc1 ls0 ws0">1&#12289;&#36890;&#36807;&#23454;&#39564;&#36827;&#19968;&#27493;&#23398;&#20064;&#21333;&#22238;&#36335;&#21453;&#39304;&#25511;&#21046;&#31995;&#32479;&#30340;&#32452;&#25104;&#21644;&#24037;&#20316;&#21407;&#29702;&#12290;</div><div class="t m0 x2 h4 y7 ff1 fs1 fc0 sc1 ls0 ws0">2<span class="_ _1"></span>&#12289;&#25484;<span class="_ _1"></span>&#25569;<span class="_ _1"></span><span class="ff3">P</span>&#12289;<span class="_ _1"></span><span class="ff3">PI<span class="_ _1"></span></span>&#21644;<span class="_ _1"></span><span class="ff3">PID</span>&#35843;<span class="_ _1"></span>&#33410;&#22120;<span class="_ _1"></span>&#21407;<span class="_ _1"></span>&#29702;&#65292;<span class="_ _1"></span>&#24182;&#32534;<span class="_ _1"></span>&#20889;<span class="_ _1"></span>&#27604;&#20363;<span class="_ _1"></span>&#25511;<span class="_ _1"></span>&#21046;&#31639;<span class="_ _1"></span>&#27861;&#65292;<span class="_ _1"></span>&#27604;<span class="_ _1"></span>&#20363;&#31215;<span class="_ _1"></span>&#20998;<span class="_ _1"></span>&#25511;&#21046;<span class="_ _1"></span>&#31639;&#27861;<span class="_ _1"></span>&#65292;<span class="_ _1"></span>&#27604;&#20363;<span class="_ _1"></span>&#12289;<span class="_ _1"></span>&#31215;&#20998;<span class="_ _2"></span>&#12289;</div><div class="t m0 x3 h4 y8 ff1 fs1 fc0 sc1 ls0 ws0">&#24494;&#20998;&#25511;&#21046;&#31639;&#27861;&#65292;&#24182;&#36827;&#34892;&#21442;&#25968;&#25972;&#23450;&#65292;&#20351;&#24471;&#28082;&#20301;&#25511;&#21046;&#22312;<span class="ff3">20cm</span>&#22788;&#65292;&#36229;&#35843;&#37327;&#19981;&#36229;&#36807;<span class="ff3">10%</span>&#65292;&#31283;&#24577;&#35823;&#24046;<span class="ff3">5%</span>&#12290;</div><div class="t m0 x2 h4 y9 ff1 fs1 fc0 sc1 ls0 ws0">3&#12289;&#23450;&#24615;&#22320;&#30740;&#31350;<span class="ff3">P</span>&#12289;<span class="ff3">PI</span>&#21644;<span class="ff3">PID</span>&#35843;&#33410;&#22120;&#30340;&#21442;&#25968;&#23545;&#31995;&#32479;&#24615;&#33021;&#30340;&#24433;&#21709;&#12290;</div><div class="t m0 x4 h5 ya ff1 fs2 fc0 sc0 ls0 ws0">&#20108;&#12289;&#23454;&#39564;&#35774;&#22791;</div><div class="t m0 x2 h4 yb ff1 fs1 fc0 sc1 ls0 ws0">&#36807;&#31243;&#25511;&#21046;&#23454;<span class="_ _1"></span>&#39564;&#35013;&#32622;&#12289;&#19975;&#29992;&#34920;&#12289;&#35745;&#31639;<span class="_ _1"></span>&#26426;&#25511;&#21046;&#25945;&#23398;&#23454;&#39564;&#24320;&#21457;&#24179;<span class="_ _1"></span>&#21488;CC-<span class="_ _1"></span>1&#22411;&#12289;<span class="ff3">ADS1.2</span>&#36719;&#20214;&#24320;&#21457;<span class="_ _1"></span>&#29615;&#22659;&#65292;</div><div class="t m0 x3 h4 yc ff1 fs1 fc0 sc1 ls0 ws0">&#23454;&#39564;&#36830;&#25509;&#32447;&#25968;&#26681;&#12290;</div><div class="t m0 x4 h5 yd ff1 fs2 fc0 sc0 ls0 ws0">&#19977;&#12289;&#23454;&#39564;&#21407;&#29702;</div><div class="t m0 x5 h6 ye ff1 fs3 fc0 sc1 ls0 ws0">&#22270;<span class="ff3">1 </span>&#38381;&#29615;&#25511;&#21046;&#31995;&#32479;&#21407;&#29702;&#22270;</div><div class="t m0 x2 h4 yf ff1 fs1 fc0 sc1 ls0 ws0">&#22270;<span class="ff3">1</span>&#20026;&#21333;&#22238;&#36335;&#27700;&#31665;&#28082;&#20301;&#25511;&#21046;&#31995;&#32479;&#12290;&#21333;&#22238;&#36335;&#35843;&#33410;&#31995;&#32479;&#19968;&#33324;&#25351;&#22312;&#19968;&#20010;&#35843;&#33410;&#23545;&#35937;&#19978;&#29992;&#19968;&#20010;&#35843;&#33410;&#22120;&#26469;</div><div class="t m0 x3 h4 y10 ff1 fs1 fc0 sc1 ls0 ws0">&#20445;&#25345;<span class="_ _1"></span>&#19968;&#20010;&#21442;<span class="_ _1"></span>&#25968;&#30340;<span class="_ _1"></span>&#24658;&#23450;&#65292;&#32780;<span class="_ _1"></span>&#35843;&#33410;<span class="_ _1"></span>&#22120;&#21482;&#25509;<span class="_ _1"></span>&#21463;&#19968;&#20010;<span class="_ _1"></span>&#27979;&#37327;<span class="_ _1"></span>&#20449;&#21495;&#65292;&#20854;<span class="_ _1"></span>&#36755;&#20986;<span class="_ _1"></span>&#20063;&#21482;&#25511;<span class="_ _1"></span>&#21046;&#19968;&#20010;<span class="_ _1"></span>&#25191;&#34892;<span class="_ _1"></span>&#26426;&#26500;&#12290;<span class="_ _1"></span>&#26412;&#31995;&#32479;</div><div class="t m0 x3 h4 y11 ff1 fs1 fc0 sc1 ls0 ws0">&#25152;&#35201;<span class="_ _1"></span>&#20445;&#25345;&#30340;<span class="_ _1"></span>&#21442;&#25968;<span class="_ _1"></span>&#26159;&#28082;&#20301;&#30340;<span class="_ _1"></span>&#32473;&#23450;<span class="_ _1"></span>&#39640;&#24230;&#65292;<span class="_ _1"></span>&#21363;&#25511;&#21046;<span class="_ _1"></span>&#30340;&#20219;<span class="_ _1"></span>&#21153;&#26159;&#25511;&#21046;<span class="_ _1"></span>&#27700;&#31665;<span class="_ _1"></span>&#28082;&#20301;&#31561;<span class="_ _1"></span>&#20110;&#32473;&#23450;<span class="_ _1"></span>&#20540;&#25152;<span class="_ _1"></span>&#35201;&#27714;&#30340;<span class="_ _1"></span>&#39640;&#24230;&#12290;</div><div class="t m0 x3 h4 y12 ff1 fs1 fc0 sc1 ls0 ws0">&#26681;&#25454;<span class="_ _1"></span>&#25511;&#21046;&#26694;<span class="_ _1"></span>&#22270;&#65292;<span class="_ _1"></span>&#36825;&#26159;&#19968;&#20010;<span class="_ _1"></span>&#38381;&#29615;<span class="_ _1"></span>&#21453;&#39304;&#21333;<span class="_ _1"></span>&#22238;&#36335;&#28082;<span class="_ _1"></span>&#20301;&#25511;<span class="_ _1"></span>&#21046;&#12290;&#24403;&#35843;<span class="_ _1"></span>&#33410;&#26041;<span class="_ _1"></span>&#26696;&#30830;&#23450;<span class="_ _1"></span>&#20043;&#21518;&#65292;<span class="_ _1"></span>&#25509;&#19979;<span class="_ _1"></span>&#26469;&#23601;&#26159;<span class="_ _1"></span>&#25972;&#23450;&#35843;</div><div class="t m0 x3 h4 y13 ff1 fs1 fc0 sc1 ls0 ws0">&#33410;&#22120;<span class="_ _1"></span>&#30340;&#21442;&#25968;<span class="_ _1"></span>&#65292;&#19968;<span class="_ _1"></span>&#20010;&#21333;&#22238;&#36335;<span class="_ _1"></span>&#31995;&#32479;<span class="_ _1"></span>&#35774;&#35745;&#23433;<span class="_ _1"></span>&#35013;&#23601;&#32490;<span class="_ _1"></span>&#20043;&#21518;<span class="_ _1"></span>&#65292;&#25511;&#21046;&#36136;<span class="_ _1"></span>&#37327;&#30340;<span class="_ _1"></span>&#22909;&#22351;&#19982;<span class="_ _1"></span>&#25511;&#21046;&#22120;<span class="_ _1"></span>&#21442;&#25968;<span class="_ _1"></span>&#36873;&#25321;&#26377;<span class="_ _1"></span>&#30528;&#24456;&#22823;</div><div class="t m0 x3 h4 y14 ff1 fs1 fc0 sc1 ls0 ws0">&#30340;&#20851;<span class="_ _1"></span>&#31995;&#12290;&#21512;<span class="_ _1"></span>&#36866;&#30340;<span class="_ _1"></span>&#25511;&#21046;&#21442;&#25968;<span class="_ _1"></span>&#65292;&#21487;<span class="_ _1"></span>&#20197;&#24102;&#26469;<span class="_ _1"></span>&#28385;&#24847;&#30340;<span class="_ _1"></span>&#25511;&#21046;<span class="_ _1"></span>&#25928;&#26524;&#12290;&#21453;<span class="_ _1"></span>&#20043;&#65292;<span class="_ _1"></span>&#25511;&#21046;&#22120;<span class="_ _1"></span>&#21442;&#25968;&#36873;<span class="_ _1"></span>&#25321;&#24471;<span class="_ _1"></span>&#19981;&#21512;&#36866;<span class="_ _1"></span>&#65292;&#21017;&#20250;</div><div class="t m0 x3 h4 y15 ff1 fs1 fc0 sc1 ls0 ws0">&#20351;&#25511;<span class="_ _1"></span>&#21046;&#36136;&#37327;<span class="_ _1"></span>&#21464;&#22351;<span class="_ _1"></span>&#65292;&#36798;&#19981;&#21040;<span class="_ _1"></span>&#39044;&#26399;<span class="_ _1"></span>&#25928;&#26524;&#12290;<span class="_ _1"></span>&#19968;&#20010;&#25511;<span class="_ _1"></span>&#21046;&#31995;<span class="_ _1"></span>&#32479;&#35774;&#35745;&#22909;<span class="_ _1"></span>&#20197;&#21518;<span class="_ _1"></span>&#65292;&#31995;&#32479;<span class="_ _1"></span>&#30340;&#25237;&#36816;<span class="_ _1"></span>&#21644;&#21442;<span class="_ _1"></span>&#25968;&#25972;&#23450;<span class="_ _1"></span>&#26159;&#21313;&#20998;</div><div class="t m0 x3 h4 y16 ff1 fs1 fc0 sc1 ls0 ws0">&#37325;&#35201;&#30340;&#24037;&#20316;&#12290;</div><div class="t m0 x2 h4 y17 ff1 fs1 fc0 sc1 ls0 ws0">&#19968;&#33324;&#35328;<span class="_ _1"></span>&#20043;&#65292;&#29992;&#27604;&#20363;<span class="_ _1"></span>&#65288;<span class="ff3">P<span class="_ _1"></span></span>&#65289;&#35843;&#33410;&#22120;<span class="_ _1"></span>&#30340;&#31995;&#32479;&#26159;<span class="_ _1"></span>&#19968;&#20010;&#26377;&#24046;&#31995;<span class="_ _1"></span>&#32479;&#65292;&#27604;&#20363;<span class="_ _1"></span>&#24230;<span class="_ _1"></span>&#948;<span class="_ _1"></span>&#30340;&#22823;&#23567;&#19981;&#20165;<span class="_ _1"></span>&#20250;&#24433;&#21709;&#21040;<span class="_ _1"></span>&#20313;&#24046;</div><div class="t m0 x3 h4 y18 ff1 fs1 fc0 sc1 ls0 ws0">&#30340;&#22823;<span class="_ _1"></span>&#23567;&#65292;&#32780;<span class="_ _1"></span>&#19988;&#20063;<span class="_ _1"></span>&#19982;&#31995;&#32479;&#30340;<span class="_ _1"></span>&#21160;&#24577;<span class="_ _1"></span>&#24615;&#33021;&#23494;<span class="_ _1"></span>&#20999;&#30456;&#20851;<span class="_ _1"></span>&#12290;&#27604;<span class="_ _1"></span>&#20363;&#31215;&#20998;&#65288;<span class="_ _3"> </span><span class="ff3">PI</span>&#65289;<span class="_ _1"></span>&#35843;&#33410;&#22120;<span class="_ _1"></span>&#65292;&#30001;&#20110;<span class="_ _1"></span>&#31215;&#20998;<span class="_ _1"></span>&#30340;&#20316;&#29992;<span class="_ _1"></span>&#65292;&#19981;&#20165;</div><div class="t m0 x3 h4 y19 ff1 fs1 fc0 sc1 ls0 ws0">&#33021;&#23454;&#29616;&#31995;&#32479;&#26080;&#20313;&#24046;&#65292;&#32780;&#19988;&#21482;&#35201;&#21442;&#25968;&#948;&#65292;<span class="ff3">Ti<span class="_ _1"></span></span>&#35843;&#33410;&#21512;&#29702;&#65292;&#20063;&#33021;&#20351;&#31995;&#32479;&#20855;&#26377;&#33391;&#22909;&#30340;&#21160;&#24577;&#24615;&#33021;&#12290;&#27604;&#20363;&#31215;&#20998;</div><div class="t m0 x3 h4 y1a ff1 fs1 fc0 sc1 ls0 ws0">&#24494;&#20998;&#65288;<span class="_ _1"></span><span class="ff3">PID</span>&#65289;&#35843;&#33410;&#22120;&#26159;&#22312;<span class="_ _1"></span><span class="ff3">PI</span>&#35843;&#33410;<span class="_ _1"></span>&#22120;&#30340;&#22522;&#30784;&#19978;&#20877;&#24341;&#20837;<span class="_ _1"></span>&#24494;&#20998;<span class="_ _1"></span><span class="ff3">D</span>&#30340;<span class="_ _1"></span>&#20316;&#29992;&#65292;&#20174;&#32780;&#20351;&#31995;&#32479;<span class="_ _1"></span>&#26082;&#26080;&#20313;&#24046;&#23384;&#22312;&#65292;&#21448;</div></div></div><div class="pi" data-data='{"ctm":[1.568627,0.000000,0.000000,1.568627,0.000000,0.000000]}'></div></div> </body> </html>

相关推荐