00001 /* This file has been prepared for Doxygen automatic documentation generation.*/ 00029 #ifndef PID_H 00030 #define PID_H 00031 00037 #define SCALING_FACTOR 256 00038 00039 00044 typedef struct pidData{ 00046 int16_t lastProcessValue; 00048 int32_t sumError; 00050 int16_t P_Factor; 00052 int16_t I_Factor; 00054 int16_t D_Factor; 00056 int16_t maxError; 00058 int32_t maxSumError; 00059 } pidData_t; 00060 00061 00063 #define MAX_INT 32767 00064 00066 #define MAX_LONG 2147483647L 00067 00075 #define MAX_I_TERM (MAX_LONG - (2 * (int32_t)MAX_INT)) 00076 00077 // Boolean values 00079 #define FALSE 0 00080 00082 #define TRUE (!FALSE) 00083 00084 00085 //Prototypes 00086 void PID_Init(int16_t p_factor, int16_t i_factor, int16_t d_factor, pidData_t *pid); 00087 int16_t PID_Controller(int16_t setPoint, int16_t processValue, pidData_t *pid_st); 00088 void PID_Reset_Integrator(pidData_t *pid_st); 00089 00090 #endif
1.4.4