codesys isarray
时间: 2023-09-20 19:13:46 浏览: 84
`isarray` is a built-in function in CODESYS that is used to check if a variable is an array. It returns a boolean value (TRUE or FALSE) indicating whether the variable is an array or not. The syntax for `isarray` is:
```
isarray(variable)
```
where `variable` is the name of the variable to be checked. If `variable` is an array, `isarray` returns TRUE. Otherwise, it returns FALSE. Here's an example:
```
PROGRAM Example
VAR
MyArray: ARRAY[1..10] OF INT;
MyInt: INT;
IsMyArray: BOOL;
END_VAR
IsMyArray := isarray(MyArray); // returns TRUE
IsMyArray := isarray(MyInt); // returns FALSE
```
In this example, the `isarray` function is used to check whether the variable `MyArray` is an array. Since `MyArray` is indeed an array, `isarray` returns TRUE and the result is stored in the variable `IsMyArray`.
阅读全文