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);
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 signupOpens plcsimulationsoftware.com — same team
Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad
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 →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 signupOpens plcsimulationsoftware.com — same team
Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad