Skip to main content

7.7.2 MAX

Function

Take the maximum value function and assign the maximum value in IN1...INn to OUT

LD graphics

Alt text

Parameter description

Interface variableDeclarationData typeDescription
IN1Var_InputANY_ELEMENTARYComparison number 1
IN2Var_InputANY_ELEMENTARYComparison number 2
Function nameReturn valueANY_ELEMENTARYOutput maximum value
warning
  • The parameter types of parameters IN1, IN2 and OUT must be the same, otherwise the function cannot be executed
  • MAX is an extensible function, and inputs can be added by clicking the "+" in the graph
  • ANY_ELEMENTARY includes all basic types (bit strings, integers, floating point numbers, characters and strings, times and dates)

Example

  • LD sample animation is as follows:

alt text

  • ST example is shown in the following code:
OUT:=MAX(IN1:=10,IN2:=100);
OUT2:=MAX(IN1:=10,IN2:=100,IN3:=1000,IN4:=10000,IN5:=50000);