資源簡介
C語言 增量式 PID 代碼 測試可用的 只需要調節KP KI KD即可
代碼片段和文件信息
/*
?*?PID.c
?*
?*??Created?on:?2013-3-23
?*??????Author:?feng
?*/
#include?“PID.h“
static?PID?PID_RANGE;
void?PID_InitCalc(void);
void?Servo_PIDControl(void);
void?PID_Init(PID*?p_PID);
int16?PID_Calc(PID*?p_PID?int32?PID_ADC0?int32?PID_ADC6);
void?PID_InitCalc(void)
{
PID_Init(&PID_RANGE);
}
void?Servo_PIDControl(void)
{
uint32?temp_adc0;
uint32?temp_adc6;
int32?temp_speed;
signed?long?temp_scope;
temp_adc0?=?GetADCValue(0x00);//select?channel?ADC0
temp_adc0?=?ADC0_Kalman_Filter((uint32)temp_adc0);//filter
Uart1_Send_Scope(temp_adc01);
temp_adc6?=?GetADCValue(0x06);//select?channel?ADC6
temp_adc6?=?ADC6_Kalman_Filter((uint32)temp_adc6);//filter
Uart1_Send_Scope(temp_adc62);
temp_scope?=?(signed?long)temp_adc0?-?(signed?long)temp_
- 上一篇:商品信息管理系統c++課程設計
- 下一篇:純C++實現bmp圖片旋轉
評論
共有 條評論