====== IpidItermLimit() ====== ''IpidItermLimit()'' limits the minimum and maximum of the PID integral term. {{:en-us_commands:reference:ipiditermlimit.svg?900|IpidItermLimit command operation flow}} ''void IpidItermLimit(uint8_t id, float iMin, float iMax)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''IpidItermLimit(id, iMin, iMax)'' | ''uint8_t id'' — PID loop number. Supports ''0'' ~ ''255''\\ ''float iMin''\\ ''float iMax'' | ''void'' | Limits the minimum and maximum of the PID integral term. | ===== Example ===== This example reads the raw A0 analog value (0–1023) on MPINO-16A8R8T for the PID calculation. It shows the result only in Serial Monitor and does not drive an output. Check the A0 voltage/current setting for the connected sensor. const uint8_t PID_ID = 0; void setup() { Serial.begin(115200); IpidSet(PID_ID, 2.0F, 0.4F, 0.1F, 100, 0.0F, 1023.0F); // Set PID gains, sample interval, and output range. IpidItermLimit(PID_ID, -100.0F, 100.0F); // Limit the integral term to -100 through 100. } void loop() { const float currentValue = analogRead(A0); // Read the raw ADC value from A0. const float result = IpidRun(PID_ID, currentValue, 512.0F); // Calculate PID output from the A0 raw value and setpoint 512. Serial.println(result); delay(100); } ===== Precautions ===== * PID output can directly affect field equipment. Begin testing with a low output range and small gains. * ''IpidRun()'' retains the previous output until the ''sampleMs'' interval has elapsed. It may be called repeatedly in ''loop()''. * The integral term is automatically constrained by the output limits to reduce windup. Use ''IpidItermLimit()'' if additional limits are needed. * The derivative term is calculated from the PV change to reduce abrupt jumps caused by setpoint changes. * ''IpidReset()'' resets the integral term, previous PV and previous output value. * Use the same ''id'' for only one control loop. ===== Built-in Commands in the Same Category ===== * [[:en-us_commands:reference:ipidset|IpidSet() View detailed description]] * [[:en-us_commands:reference:ipidrun|IpidRun() View detailed description]] * [[:en-us_commands:reference:ipidreset|IpidReset() View detailed description]] * [[:en-us_commands:reference:ipidreverse|IpidReverse() View detailed description]] * [[:en-us_commands:reference:ipidoutput|IpidOutput() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]