# CODESYS MAX

Instructions · `MAX` · verification: source checked

MAX is an IEC operator that returns the greatest value among its inputs. It is written as OUT := MAX(IN0, IN1, IN2, ...). The CODESYS example MAX(30,90,40) returns 90, and nested MAX calls are also shown.

## Specification

| Property | Value |
|---|---|
| Language | structured text |
| Code | MAX |
| Group | maximum function |
| Syntax | OUT := MAX(IN0,IN1,IN2,...) |
| Dialect | CODESYS |

## Study notes

- The operator implements the maximum function.
- Permitted data types: all.
- Example: Var1 := MAX(30,90,40); returns 90.
- Nested example: Var1 := MAX(40,MAX(90,30));
- The syntax allows multiple inputs: IN0, IN1, IN2, ...

## Sources

1. [Beckhoff Information System](https://infosys.beckhoff.com/content/1033/tc3_plc_intro/2528961419.html) (accessed 2026-10-26)
2. [CODESYS Group](https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_operator_max.html) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/iec-max  
JSON: https://machineschema.com/instruction/iec-max.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
