max (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


The max function takes two numbers as parameters and returns the value of the highest of the two numbers.

 

Input:

a : DINT

The first value.

 

b : DINT

The second value.

 

Returns: DINT

The highest value.

 

Declaration:

FUNCTION max : DINT;
VAR_INPUT
  a : DINT;
  b : DINT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  number1 : INT;
  number2 : INT;
  result : INT;
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  result:=INT(max(a:=number1, b:=number2));
  ...
END;
 
END_PROGRAM;