Skip to main content

MIN

Compares Value1 and Value2 and stores the lower value in Result.

Ladder Representation

MIN block

Block Structure

Variable TypeNameData TypeDescription
VAR_INPUTENBOOLBlock enabling.
VAR_INPUTValue1BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REALFirst comparison value.
VAR_INPUTValue2BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REALSecond comparison value.
VAR_OUTPUTDoneBOOLEnd of operation.
VAR_OUTPUTResultBYTE USINT SINT WORD UINT INT DWORD UDINT DINT REALLower 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

MIN execution flowchart

Examples

MIN ladder example 1

This example calculates the minimum value between VALUE1 and VALUE2 and stores the final result in RESULT. The block completes successfully and activates Done.

MIN ladder example 2

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.

MIN ladder example 3

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.