Navigation:  Equipments (Devices) > SCA06 > Ladder > Math > Math Util >

MIN

Previous pageReturn to chapter overviewNext page

Block that compares the values of Value1 and Value2 and stores the lowest of them in Result.

 

Ladder Representation

 

MIN_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

Value1

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL

First value of comparison

Value2

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL

Second value of comparison

VAR_OUTPUT

Done

BOOL

End of operation

Result

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL LREAL

Lowest of the values compared

 

Operation

 

When this block has a TRUE value in EN, it sends to the Result output the lowest value in the comparison between Value1 and Value2. If no errors, the Done variable is set. If there is any error in the operation, Done is not set, staying in FALSE status, while Result remains with its value unchanged.

 

When EN has FALSE value, Result remains unchanged and Done remains in FALSE.

 

Block Flowchart

 

MIN_flowchart

 

Example in Ladder

 

MIN_example01

 

The above example calculates the minimum value between VALUE 1 and VALUE2 variables, storing the final result in RESULT. The block ends with success and Done output is activated.

 

MIN_example02

 

The above example calculates the minimum value between VALUE 1 and VALUE2 variables, storing the final result in RESULT. The block ends with success and Done output is activated. Notice that the types of the input variables can be different without causing execution problems.

 

MIN_example03

 

The above example calculates the minimum value between VALUE 1 and VALUE2 variables, storing the final result in RESULT. Since the result is lower than the minimum supported by SINT type, the block generates an error and Done output is disabled.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   VALUE1 : REAL := -90.8;

   VALUE2 : SINT := 32;

   RESULT : SINT;

END_VAR

 

RESULT := FB_MIN(

   EN:=DI1,

   Value1:=VALUE1,

   Value2:=VALUE2,

  Done=>DO1);