7.2.2 PIDCoeffCalc

Description

PIDCoeffCalc computes the PID coefficients based on values of Kp, Ki and Kd provided by the user.

abcCoefficients[0] = Kp + Ki + Kd

abcCoefficients[1] = -(Kp + 2*Kd)

abcCoefficients[2] = Kd

This routine also clears the delay line elements in the array ControlDifference as well as clears the current PID output element, ControlOutput.

Prototype

void PIDCoeffCalc (fractional *PIDGainCoeff, tPID *PIDStruct);

Arguments

Parameters

Description

PIDGainCoeff

Pointer to an input array containing Kp, Ki, Kd coefficients in order [Kp, Ki, Kd]

PIDStruct

Pointer to a PID data structure of type tPID

Returns

None

Remarks

PID coefficient array elements may be subject to saturation depending on values of Kp, Ki, Kd.

Source File

  • pid_aa.s

Function Profile

Device

Program Words

Cycles

PIC32A

15

28

System resource usage

  • W0 - used, not restored
  • ACCA, ACCB - used, not restored
  • CORCON - saved, used, restored
  • REPEAT instruction usage – None