60 error = setPoint - processValue;
67 else if (error < -pid_st->maxError)
83 else if (temp < -pid_st->maxSumError)
94#if (PID_K_D_ENABLE == TRUE)
101#if (PID_K_D_ENABLE == TRUE)
107#if (SCALING_FACTOR_ENABLED == TRUE)
120 return ((uint16_t)ret);
135#if (PID_K_D_ENABLE == TRUE)
#define MAX_INT
Maximum value of integers.
void PIDInit(int16_t p_factor, int16_t i_factor, int16_t d_factor, pidData_t *pid)
Initialisation of PID controller parameters.
uint16_t PIDController(int16_t setPoint, int16_t processValue, pidData_t *pid_st)
PID control algorithm.
void PIDResetIntegrator(pidData_t *pid_st)
Resets the integrator in the PID regulator.
PID controller header file.
#define SCALING_FACTOR
Scaling division factor for PID controller.
#define MAX_I_TERM
Maximum value of the I-term.
int32_t maxSumError
Maximum allowed sum error, avoid overflow.
int16_t P_Factor
The Proportional tuning constant, given in x100.
int16_t maxError
Maximum allowed error, avoid overflow.
int16_t D_Factor
The Derivative tuning constant, given in x100.
int16_t d_term
The D-term represents the rate of change of the error.
int32_t sumError
Summation of errors, used for integrate calculations.
int16_t I_Factor
The Integral tuning constant, given in x100.
int16_t p_term
The P-term represents the immediate response to the current error.
int16_t lastProcessValue
Last process value, used to find derivative of process value.