MIN
Compares Value1 and Value2 and stores the lower value in Result.
Ladder Representation
Block Structure
| Variable Type | Name | Data Type | Description |
|---|---|---|---|
| VAR_INPUT | EN | BOOL | Block enabling. |
| VAR_INPUT | Value1 | BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL | First comparison value. |
| VAR_INPUT | Value2 | BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL | Second comparison value. |
| VAR_OUTPUT | Done | BOOL | End of operation. |
| VAR_OUTPUT | Result | BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL | Lower of the compared values. |
Operation
When EN is TRUE, the block compares Value1 and Value2 and writes the lower value to Result.
If the operation completes without errors, Done is set. If an operation error occurs, Done remains FALSE and Result keeps its previous value.
When EN is FALSE, Result remains unchanged and Done remains FALSE.
Execution Flowchart

Examples
- Ladder Example
- Structured Text Example
This example calculates the minimum value between VALUE1 and VALUE2 and stores the final result in RESULT. The block completes successfully and activates Done.
This example calculates the minimum value between VALUE1 and VALUE2 and stores the final result in RESULT. The block completes successfully and activates Done. The input variable types can differ without causing execution problems.
This example calculates the minimum value between VALUE1 and VALUE2 and stores the final result in RESULT. Because the result is lower than the minimum value supported by SINT, the block reports an error and disables Done.
The following Structured Text code applies the same logic shown in the Ladder example.
VAR
VALUE1 : REAL := -90.8;
VALUE2 : SINT := 32;
RESULT : SINT;
END_VAR
RESULT := FB_MIN(
EN:=DI1,
Value1:=VALUE1,
Value2:=VALUE2,
Done=>DO1);