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

MUL

Previous pageReturn to chapter overviewNext page

Block that calculates the multiplication of the values of Value1 and Value2, storing the result in Result.

 

Ladder Representation

 

MUL_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

First factor of the operation

Value2

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL

Second factor of the operation

VAR_OUTPUT

Done

BOOL

End of operation

Result

BYTE USINT SINT WORD UINT INT DWORD UDINT DINT REAL

Variable that stores the result of the operation

 

Operation

 

When this block has a TRUE value in EN, it sends to the Result output the multiplication of Value1 and Value2 variables. 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

 

MUL_flowchart

 

Example in Ladder

 

MUL_example01

 

The above example calculates the product of VALUE 1 and VALUE2 variables, storing the final result in RESULT.

 

MUL_example02

 

The above example calculates the product of VALUE 1 and VALUE2 variables, storing the final result in RESULT. Notice that the block accepts arguments of both signs.

 

MUL_example03

 

The above example calculates the product of VALUE1 and VALUE2 variables. The final result 224 cannot be stored in RESULT, because it is outside the limits of accepted values by SINT type. Therefore, RESULT remains unchanged and the output is disabled.

 

Example in ST

 

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

 

 

VAR

  VALUE1 : SINT := 8;

   VALUE2 : SINT := -9;

   RESULT : SINT;

END_VAR

 

RESULT := FB_MUL(

   EN:=DI1,

   Value1:=VALUE1,

   Value2:=VALUE2,

   Done=>DO1);