MIN_2D_ARRAY block
Short summary
Name |
MIN_2D_ARRAY_LINT, MIN_2D_ARRAY_ULINT, MIN_2D_ARRAY_LREAL |
→POU type |
|
Category |
|
Conform to →IEC-standard |
not defined in IEC-standard |
Graphical interface |
, , |
Available since |
|
Functionality
The block returns the smallest of all values of an a rray with 2 dimensions entered at input A. Only the first M rows and N columns are considered. The array must contain at least M rows and N columns.
Inputs, return value
MIN_2D_ARRAY_LINT |
Identifier |
Description |
|
In-outs |
A |
ARRAY [*,*] OF SINT, INT, DINT or LINT(corresponds to →generic data type ANY_SIGNED) |
variable-length array |
Inputs: |
M |
UINT |
number of rows to consider |
N |
UINT |
number of columns to consider |
|
Return value: |
– |
LINT |
|
MIN_2D_ARRAY_ULINT |
Identifier |
Description |
|
In-outs |
A |
ARRAY [*,*] OF USINT, UINT, UDINT or ULINT(corresponds to →generic data type ANY_UNSIGNED) |
variable-length array |
Inputs: |
M |
UINT |
number of rows to consider |
N |
UINT |
number of columns to consider |
|
Return value: |
– |
ULINT |
|
MIN_2D_ARRAY_LREAL |
Identifier |
Description |
|
In-outs |
A |
ARRAY [*,*] OF REAL, LREAL(corresponds to →generic data type ANY_REAL) |
variable-length array |
Inputs: |
M |
UINT |
number of rows to consider |
N |
UINT |
number of columns to consider |
|
Return value: |
– |
LREAL |
|
Input EN and output ENO are available when →calling
the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
Internal error diagnostic for block
The block checks whether the size of the array for A contains at least M rows and N columns. If this is not the case, the output ENO of the block is set to value FALSE (or an equivalent).
Example for usage within ST-editor
FUNCTION_BLOCK ExampleMin2DArray
VAR
inputArray : ARRAY [
1
..
2
, -
1
..
1
] OF LINT := [
2
( [
1
,
2
,
3
])];
result1, result2 : LINT;
enoCheck1, enoCheck2 : BOOL;
END_VAR
result1 := MIN_2D_ARRAY_LINT(A := inputArray, M :=
2
, N :=
3
, ENO => enoCheck1);
// 'result1' evaluates to value '1'. 'enoCheck1' evaluates to 'TRUE'.
// check the results
ENO := AND(result1 =
1
, enoCheck1);
result2 := MIN_2D_ARRAY_LINT(A := inputArray, M :=
3
, N :=
2
, ENO => enoCheck2);
// 'enoCheck2' evaluates to 'FALSE' because 'inputArray' has only 2 rows.
// 'result2' evaluates to '0'.
// check the results
ENO := AND(ENO, result2 =
0
, NOT(enoCheck2));
END_FUNCTION_BLOCK
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.