Specifying an Array Variable or Structure Variable as a Parameter
You can also specify an array variable or a structure variable as an input or output parameter.
However, it will take longer to pass and receive data for these data types in comparison to a vari-
able with a basic data type (depending on the size). Therefore, when handling array variables or
structure variables in a function block, we recommend that you design them in such a way that
these variables are passed to and received from in-out variables.
Example 1: Specifying an Array
Example 2: Specifying a Structure Variable
FB
IN1 OUT1
x
Program Variable Table
Variable name Data type
x ARRAY[0..199] OF INT
FB
INOUT INOUT
x
Do not assign INT variable x [0..199] to the function block input variable
IN1 (Data type of the IN1 input variable in the function block:
ARRAY[0..199] OF INT).
Instead, assign INT variable x [0..199] to the INOUT in-out variable of
the function block. (Data type of INOUT in-out variable in the function
block: ARRAY[0..199] OF INT)
Program Variable Table
Variable name Data type
x MyStructure
FB
OUT1 IN1
x
FB
INOUT INOUT
x
Do not assign MyStructure variable x to the IN1 input
variable of the function block (Data type of IN1 input
variable of the function block: MyStructure).
Instead, assign MyStructure variable x to the INOUT in-out
variable of the function block. (Data type of INOUT in-out
variable of the function block: MyStructure)