#ifndef _PID_H #define _PID_H #include "SysTick.h" void PID_Init(void); void PID_Calc(void); typedef struct Pid { float set_tem;// User settings float now_tem;// current temperature float Kp; // 110 float Ki; // 0.001 float Kd; // 340 int t; // PID calculation cycle - sampling cycle float Ti; float Td; float Ek; // This deviation float Ek_1;// Last deviation float SEk; // The sum of historical deviations float Iout; float Pout; float Dout; float OUT0; float OUT; int C1ms; int pwmcycle;// PWM cycle int times; float tem_offset; float tem_threshold; }PID; extern PID pid; #endif