MAX - Returns the highest value

Help Contents


Returns the highest value input from a set of inputs.


Informal Syntax:

MAX( In1, In2, ..., InX )

Formal Syntax:

MAX( In1:=expression, In1:=expression, ..., InX:=expression )


In1ANYThe first input.
In2ANYThe second input.
InXANYThe last input.

Return Value

The highest value of the inputs In1, In2, ... ,InX is returned.

Inputs In1 ... InX can be any type. The type of the return value is the "highest" type of the inputs In1 ... InX. For example if the input types are SINT, INT and DINT, the return type of the function will be DINT.

See Automatic Type Promotion for further information.


ExampleReturn Value
MAX( 'A', 'B', 'C' )STRING#'C'
MAX( In1:=-5, In2:=0, In3:=10 )DINT#10

Standards Compliance

IEC 61131-3 Second Edition: Table 27.2a.

IEC 61131-3 Third Edition: Table 32.3.

Further Information

Selection Functions

To learn about other selection functions.

Elementary Data Types

To learn about the different types supported by Fernhill SCADA.

Common Elements

To learn about other IEC 61131-3 Common Elements.


For the meaning of terms used in Fernhill SCADA.