Try a PLC free — no signup
Selection & LimitingBeginnerIEC 61131-3

MAX (Maximum Selection)

Returns the larger of two or more input values.

The MAX function returns the larger of two (or more) input values. It is used for selecting the highest reading from redundant sensors, implementing high-select control strategies, finding peak values, and ensuring minimum output levels.

Parameters

Inputs

NameTypeDescription
IN1ANY_NUMFirst value
IN2ANY_NUMSecond value

Outputs

NameTypeDescription
OUTANY_NUMMaximum value (larger of inputs)

Ladder Logic Example

// Ladder Logic - MAX (High-Select)
//
// |----[MAX]----|
// | IN1: Sensor_1        |
// | IN2: Sensor_2        |
// | OUT: Highest_Reading  |

Structured Text Example

// High-select from redundant sensors
Highest_Temp := MAX(Sensor_1, Sensor_2);

// Ensure minimum output level
Actual_Output := MAX(Calculated_Output, Min_Output);

Free · no signup to try

Run this block in your browser

Try the instruction on a live rung before you copy it into a project — nothing to install.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad

Platform-Specific Implementation

S

Siemens (TIA Portal)

Use MAX instruction in TIA Portal SCL. In LAD/FBD, use comparison with MOVE.

AB

Allen-Bradley (Studio 5000)

No direct MAX; implement with GRT comparison and MOV.

C

CODESYS

Use MAX() function in ST. Supports multiple inputs.

Common Applications

  • High-select from redundant sensors
  • Peak value tracking
  • Minimum output enforcement
  • Worst-case selection
  • Maximum demand calculation

Frequently Asked Questions

What is MAX (Maximum Selection) in PLC programming?

Returns the larger of two or more input values. The MAX function returns the larger of two (or more) input values. It is used for selecting the highest reading from redundant sensors, implementing high-select control strategies, finding peak values, and ensuring minimum output levels.

What are common applications of MAX (Maximum Selection)?

MAX (Maximum Selection) is commonly used for: High-select from redundant sensors, Peak value tracking, Minimum output enforcement, Worst-case selection, Maximum demand calculation.

How do I use MAX (Maximum Selection) in different PLC platforms?

Siemens: Use MAX instruction in TIA Portal SCL. In LAD/FBD, use comparison with MOVE. Allen-Bradley: No direct MAX; implement with GRT comparison and MOV. CODESYS: Use MAX() function in ST. Supports multiple inputs.

Free · no signup to try

Wire this block up and run it

Drop the instruction into a rung, press Run and watch it execute in your browser — then adapt it to your vendor tool.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad