Discrete PID controller implementation. Set up by giving P/I/D terms to Init_PID(), and uses a struct PID_DATA to store internal values.
Definition in file pid.c.
#include "pid.h"
#include "stdint.h"
Include dependency graph for pid.c:
Go to the source code of this file.
Functions | |
int16_t | pid_Controller (int16_t setPoint, int16_t processValue, struct PID_DATA *pid_st) |
PID control algorithm. | |
void | pid_Init (int16_t p_factor, int16_t i_factor, int16_t d_factor, struct PID_DATA *pid) |
Initialisation of PID controller parameters. | |
void | pid_Reset_Integrator (pidData_t *pid_st) |
Resets the integrator. |
|
PID control algorithm. Calculates output from setpoint, process value and PID status.
Definition at line 59 of file pid.c. References PID_DATA::D_Factor, PID_DATA::I_Factor, int16_t, int32_t, PID_DATA::lastProcessValue, MAX_I_TERM, MAX_INT, PID_DATA::maxError, PID_DATA::maxSumError, PID_DATA::P_Factor, SCALING_FACTOR, and PID_DATA::sumError. Referenced by main().
|
|
Initialisation of PID controller parameters. Initialise the variables used by the PID algorithm.
Definition at line 35 of file pid.c. References PID_DATA::D_Factor, PID_DATA::I_Factor, PID_DATA::lastProcessValue, MAX_I_TERM, MAX_INT, PID_DATA::maxError, PID_DATA::maxSumError, PID_DATA::P_Factor, and PID_DATA::sumError. Referenced by Init().
|
|
Resets the integrator. Calling this function will reset the integrator in the PID regulator. Definition at line 112 of file pid.c. References pidData_t, and PID_DATA::sumError.
|