You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
504 B
42 lines
504 B
#ifndef _PID_H
|
|
#define _PID_H
|
|
|
|
void PID_Init(void);
|
|
void PID_Calc(void);
|
|
|
|
typedef struct Pid
|
|
{
|
|
float set_tem;//用户设定值
|
|
float now_tem;//当前温度
|
|
|
|
float Kp; // 110
|
|
int t; //PID计算周期--采样周期
|
|
float Ti;
|
|
float Td;
|
|
float Ki; // 0.001
|
|
float Kd; // 340
|
|
|
|
float Ek; //本次偏差
|
|
float Ek_1;//上次偏差
|
|
float SEk; //历史偏差之和
|
|
|
|
float Iout;
|
|
float Pout;
|
|
float Dout;
|
|
|
|
float OUT0;
|
|
|
|
float OUT;
|
|
|
|
int C1ms;
|
|
|
|
int pwmcycle;//pwm周期
|
|
|
|
int times;
|
|
}PID;
|
|
|
|
extern PID pid;
|
|
#endif
|
|
|
|
|