Less than
The content of the accumulator is compared with the operand defined in the operand field. If the accumulator is less than the reference value, "TRUE" is stored in the accumulator, otherwise "FALSE".
Input
1st input: value for comparison
2nd input: reference value
Output
Result, TRUE if value for comparison is less than the reference value
Inputs can be of any data type; all input variables must be of the same data type though. Output must be of type BOOL.
This function can be expanded to a maximum of 28 input contacts, see also modifying elements.
When using more inputs, the first input is compared with the second, the second input is compared with the third input etc. If the first value is less than the second value AND the second value is less than the third value etc., TRUE will be written into result, otherwise FALSE.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
enable: BOOL:=FALSE;
comparison_value: INT:=0;
reference_value: INT:=0;
result: BOOL:=FALSE;
END_VAR
In this example the input variables (comparison_value, reference_value and enable) have been declared. Instead, you may enter constants directly into the function (enable input e.g. for tests).
If enable is set (TRUE), the comparison_value is compared with the reference_value. If the comparison_value is less than the reference_value, TRUE will be written into result, otherwise FALSE.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_VARIN,,comparison_value,7,2,9,4,);
B(B_VARIN,,reference_value,7,3,9,5,);
B(B_VAROUT,,result,15,2,17,4,);
B(B_CONTACT,,enable,3,1,5,3,);
B(B_F,E_LT-2!,Instance,9,0,15,5,,?DEN?D?D?AENO?C);
L(1,0,1,5);
L(1,2,3,2);
L(5,2,9,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY