欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
單片機PID智能小車避障Proteus仿真+程序
[打印本頁]
作者:
LOLon
時間:
2019-12-13 15:49
標題:
單片機PID智能小車避障Proteus仿真+程序
智能小車避障 仿真+實物圖
51hei截圖6.jpg
(898.59 KB, 下載次數: 85)
下載附件
2019-12-13 21:26 上傳
單片機源程序如下:
#include<pid.h>
#include "STC12C5A.h"
#include "ioConfig.h"
#include "string.h"
#include "Stdio.h"
#include "absacc.h"
#include "intrins.h"
xdata struct PID spid; // PID Control Structure
unsigned int rout; // PID Response (Output)
unsigned int rin; // PID Feedback (Input)
unsigned int temper;
unsigned int set_temper;
/************************************************
PID函數
*************************************************/
void PIDInit (struct PID *pp)
{
memset ( pp,0,sizeof(struct PID));
}
/************************************************
增量控制PID函數體
51單片機最不擅長浮點數計算,轉換成int型計算
*************************************************/
unsigned int PIDCalc( struct PID *pp, unsigned int NextPoint )
{
unsigned int dError,Error,pError;
//增量法計算公式:
//Pdt=Kp*[E(t)-E(t-1)]+Ki*E(t)+Kd*[E(t)-2*E(t-1)+E(t-2)]
Error = set_temper - NextPoint; // 偏差E(t)
pError=Error-pp->LastError; //E(t)-E(t-1)
dError=Error-2*pp->LastError+pp->PrevError; //E(t)-2*E(t-1)+E(t-2)
pp->PrevError = pp->LastError;
pp->LastError = Error;
return (
pp->Proportion * pError //比例
+ pp->Integral *Error //積分項
+ pp->Derivative * dError // 微分項
);
}
/************************************************
PID函數初始化
*************************************************/
void PIDBEGIN()
{
PIDInit(&spid); // Initialize Structure
spid.Proportion = 10; // Set PID Coefficients
spid.Integral = 5;
spid.Derivative =4;
}
復制代碼
/*****************************************/
/********* 行者 任 ********** ****/
/*****************************************/
#include<reg52.h>
#include"1602.h"
#include"pwm.h"
#include"xunji.h"
sbit POWER=P3^5;
void main (void)
{
Timer0Init();
Timer1Init();
LCD_Init();
LCD_Str(5, 0, "1421h");
LCD_Str(0,0,"***smart car***");
LCD_Str(0,1,"*DANG HONG MIN*");
while(POWER) LCD_Flash(500);;
DelayMs(50);
LCD_Write_Command(0x01);
LCD_Str(0,0,"***smart car***");
while(1)
{
xunji(800);
}
}
復制代碼
所有資料51hei提供下載:
避障仿真.rar
(67.51 KB, 下載次數: 223)
2019-12-13 21:27 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
113265
時間:
2019-12-16 15:56
有點看得不懂
作者:
798540381
時間:
2020-3-1 19:15
單片機的RST連的是什么
作者:
hj08102
時間:
2020-3-9 10:35
感謝分享,搞了好久都沒搞懂PID
作者:
hj08102
時間:
2020-3-9 10:43
有點沒看懂,你電機的反饋信號是怎么采集的呢?
作者:
sai256516
時間:
2020-3-12 10:20
沒這么看懂
作者:
linnyshow
時間:
2020-4-7 14:39
非常感謝。
作者:
1490055139
時間:
2020-4-8 14:06
非常好的資源,必須點贊支持一下
作者:
1490055139
時間:
2020-4-8 14:07
非常好的資料,必須點贊支持一下。
作者:
清雅
時間:
2020-4-22 13:39
感謝樓主
作者:
144290
時間:
2020-4-28 17:00
打不開
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1