Function Block Specifications
Note
Data type
DINT/UDINT/DWORD
LINT/ULINT/LWORD
• An array can be set only for internal variables or input-output variables.
• Any data type except for STRING can be specified for an array variable,
as long as it is an internal variable.
• When entering an array variable name in the algorithm of a function block
definition, enter the array index number in square brackets after the vari-
able name. The following three methods can be used to specify the index.
(In this case the array variable is a[].)
• Directly with numbers (for ladder or ST language programming)
Example: a[2]
• With a variable (for ladder or ST language programming)
Example: a[n], where n is a variable
Note INT, DINT, LINT, UINT, UDINT, or ULINT can be used as the vari-
able data type.
• With an equation (for ST language programming only)
Example: a[b+c], where b and c are variables
Note Equations can contain only arithmetic operators (+, −, *, and /).
An array is a collection of data elements that are the same type of data. Each
array element is specified with the same variable name and a unique index.
(The index indicates the location of the element in the array.)
A one-dimensional array is an array with just one index number.
Example: When an internal variable named SCL is set as an array variable
with 10 elements, the following 10 variables can be used:
SCL[0], SCL[1], SCL[2], SCL[3], SCL[4], SCL[5], SCL[6], SCL[7], SCL[8], and
SCL[9]
SCL
0
WORD variable
1
WORD variable
2
WORD variable
Specify SCL[3] to access this data element.
3
WORD variable
4
WORD variable
5
WORD variable
6
WORD variable
7
WORD variable
8
WORD variable
WORD variable
9
Use an array variable when specifying the first or last of multiple words in an
instruction operand to enable reusing the function block if an internal variable
with a AT property cannot be set for the operand and an external variable can-
not be set. When using an array setting for an input-output variable, specify
the address of the first word for the input parameter (CX-Programmer version
7.0 or higher). When using an array setting for an internal variable, prepare an
array variable with the number of elements for the required size, and after set-
Number of elements
1,024
512
Settings for variable SCL as an array
variable with element numbers 0 to 9.
Section 2-1
39
Need help?
Do you have a question about the CX-PROGRAMMER V8.1 and is the answer not in the manual?
Questions and answers