- Main Page
- Data Structures
- Files
- Related Pages

- File List
- Globals

# pid.h

Go to the documentation of this file.

    00001 /*This file has been prepared for Doxygen automatic documentation generation.*/
    00020 #ifndef PID_H
    00021 #define PID_H
    00022
    00023 #include "stdint.h"
    00024
    00025 #define SCALING_FACTOR  128
    00026
    00031 typedef struct PID_DATA{
    00033   int16_t lastProcessValue;
    00035   int32_t sumError;
    00037   int16_t P_Factor;
    00039   int16_t I_Factor;
    00041   int16_t D_Factor;
    00043   int16_t maxError;
    00045   int32_t maxSumError;
    00046 } pidData_t;
    00047
    00052 // Maximum value of variables
    00053 #define MAX_INT         INT16_MAX
    00054 #define MAX_LONG        INT32_MAX
    00055 #define MAX_I_TERM      (MAX_LONG / 2)
    00056
    00057 // Boolean values
    00058 #define FALSE           0
    00059 #define TRUE            1
    00060
    00061 void pid_Init(int16_t p_factor, int16_t i_factor, int16_t d_factor, struct PID_DATA *pid);
    00062 int16_t pid_Controller(int16_t setPoint, int16_t processValue, struct PID_DATA *pid_st);
    00063 void pid_Reset_Integrator(pidData_t *pid_st);
    00064
    00065 #endif