MUL block
Short summary
Name |
MUL |
→POU type |
|
Category |
|
Conform to →IEC-standard |
no restrictions |
Graphical interface |
|
Available since |
version 1.0.0 (for logi.CAD 3) |
Functionality
The mathematical function multiplication is called: The block returns the product of all values connected to the inputs.
No check of invalid connections
For some blocks, invalid connections are not checked by logi.CAD 3. Therefore, enter code in your application to detect invalid connections (e.g. IF-statements). See "Examples for invalid Connections".
See "IEC-blocks for the application" for information what the consequences of an invalid connection might be.
Inputs, return value
|
Identifier |
Description |
|
Inputs: |
IN1 |
REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT |
1st value |
IN2 |
REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT |
2nd value |
|
... (extensible until) |
|||
IN16 |
REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT |
16th value |
|
Return value: |
– |
REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT or LINT |
|
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
Example for usage within ST-editor
PROGRAM Test
VAR
result : REAL;
END_VAR
result := MUL(IN1 :=
10.0
, IN2 :=
2.0
); (* The variable
'result'
evaluates to
'20.0'
. *)
END_PROGRAM
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.
Examples for invalid connections
An invalid connection due to →overflows or →underflows might occur during a calculation using MUL.
MUL(IN1 := SINT#100, IN2 := SINT#5);
(* Overflow: '100 * 5' would evaluate to '500' but calculates '-12'. Upper limit for SINT is '127'. *)
MUL(IN1 := SINT#-100, IN2 := SINT#5);
(* Negative overflow: '-100 * 5' would evaluate to '-500' but calculates '12'. Lower limit for SINT is '-128'. *)
MUL(IN1 := REAL#1.0e38, IN2 := REAL#3.0e38);