33#define SCALING_FACTOR 256
40#define SCALING_FACTOR_ENABLED FALSE
62#if (PID_K_D_ENABLE == TRUE)
77#define MAX_LONG 2147483647L
86#define MAX_I_TERM (MAX_LONG - (2 * (int32_t)MAX_INT))
96void PIDInit(int16_t p_factor, int16_t i_factor, int16_t d_factor,
pidData_t *pid);
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.
struct pidData pidData_t
PID Status.
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.