Type
| Function block |
Description
| Returns the upper boundary of a user-defined array as defined in the data types worksheet. If an error occurs, a corresponding runtime error is output in the MESSAGES window. |
Parameters
| Inputs
ARR
Data type: | User-defined ARRAY |
Description: | Array whose upper boundary value is to be returned. |
DIM
Data type: | ANY_INT |
Description: | Dimension of the user-defined array. If the value exceeds the possible number of dimensions for arrays, the function block outputs a runtime error. Note that currently only input value 1 is supported for this parameter. |
Output
OUT
Data type: | DINT |
Description: | Upper boundary value. |
|
Example
| Boundary detection using UPPER_BOUND together with LOWER_BOUND:
- Definition of the user-defined array ('MyArray') in the data types worksheet
TYPE MyArray : ARRAY [2..10000] OF INT;
END_TYPE
- LD code
 The variable 'MyArrayVar' is of the data type 'MyArray'.
|
Error behavior
| Error behavior
The following table shows the errors which may occur while executing the function and the value returned by the function in the corresponding error case.
Error case | Output value |
No array connected to ARR | 0 |
Dimension DIM < 1 or DIM > 1 | 0 |
If any of the listed errors occurs, a string error is written to the Online log in the MESSAGES window.
Note
Controller stop on string error: The controller can be automatically stopped when a string error occurs. This allows you to locate the error in your project. To enable the automatic stop of the controller in case of a string error, activate the button in the Cockpit toolbar of the controller. |
|
Additional information
| EN/ENO behavior
The POU is only executed if TRUE is applied to the EN input. If EN = FALSE, the POU is not executed and ENO = FALSE indicates the inactivity.
If any of the errors listed under "Error behavior" occurs while executing the function, ENO is set to FALSE.
|