Learn PLCs free
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);

20 Production-Ready Ladder Logic Templates

Stop writing the same rungs from scratch. Get copy-paste-ready templates for motor control, PID loops, safety interlocks, conveyors, and more.

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.

Stop Writing Ladder Logic From Scratch

Get 20 production-ready ladder logic templates for $29 -- download instantly and use them on your next project today.

20
Ready-Made Templates
LD + ST
Both Languages Included
$29
One-Time Purchase
Get Instant Access -- $29

Instant download - 30-day money-back guarantee - Use on unlimited projects

Free PLC simulator

Wire this block up and run it

Drop the instruction into a rung, hit Run, and watch it execute in your browser. 12 guided lessons across 8 PLC dialects — free account, no credit card.

Practice PLCs free →