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
| Name | Type | Description |
|---|---|---|
| IN1 | ANY_NUM | First value |
| IN2 | ANY_NUM | Second value |
Outputs
| Name | Type | Description |
|---|---|---|
| OUT | ANY_NUM | Maximum 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
Siemens (TIA Portal)
Use MAX instruction in TIA Portal SCL. In LAD/FBD, use comparison with MOVE.
Allen-Bradley (Studio 5000)
No direct MAX; implement with GRT comparison and MOV.
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.
Related Function Blocks
MIN (Minimum Selection)
Returns the smaller of two or more input values.
View Reference →SEL (Binary Selector)
Selects between two values based on a boolean condition: FALSE=IN0, TRUE=IN1.
View Reference →LIMIT (Limiter / Clamp)
Clamps a value between minimum and maximum boundaries.
View Reference →MUX (Multiplexer)
Selects one of N input values based on an integer selector index.
View Reference →LIMIT (Value Limiter)
Constrains input value to specified minimum and maximum range.
View Reference →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.
Instant download - 30-day money-back guarantee - Use on unlimited projects