22 LABELS
22.5 Arrays
379
22
How to use arrays
To use an array, add an index enclosed by '[ ]' after each label name to identify individual labels.
An array with two or more dimensions should be represented with indexes delimited by a comma (,) in '[ ]'.
The following table lists the types of indexes that can be specified for arrays.
• The data storage location becomes dynamic by specifying a label for the array index. This enables arrays to
be used in a program that executes loop processing. The following is a program example that consecutively
stores "1234" in the "uLabel4" array.
• The element number of the array can be omitted in ladder diagram. If the element number is omitted, it is
regarded as the start number and converted. For example, when the defined label name is "boolAry" and
the data type is "Bit (0..2, 0..2)", the operation of "boolAry[0,0]" is the same as that of "boolAry".
• When a multidimensional array is specified as setting data of instructions, functions, and function blocks
that use arrays, the rightmost element is regarded as a one-dimensional array.
Type
Specification example
Remarks
Constant
bLabel1[0]
An integer can be specified.
Device
bLabel1[D0]
A word device, double-word device, decimal constant, or hexadecimal
constant can be specified. (ST, LST, G, and HG cannot be specified.)
Label
bLabel1[uLabel2]
The following data types can be specified.
• Word [unsigned]/bit string [16 bits]
• Double word [unsigned]/bit string [32 bits]
• Word [signed]
• Double word [signed]
Expression
bLabel1[5+4]
Expressions can be specified only in ST language.
bLabel1 [0]
bLabel2 [0,3]
Label name
Index
bLabel1
INC
wLabel3
bLabel2
MOV
K1234
uLabel4[wLabel3]
bLabel3
wLabel1
wLabel2
[0]
[1]
[3]
[0,0]
[0,3]
[1,0]
[0,1]
[1,1]
[3,0]
[3,3]
[2]
[0,2]
[1,2]
[1,3]
[2,3]
[2,2]
[2,1]
[2,0]
[3,2]
[3,1]
BMOV
wLabel1
wLabel2
K3
Summary of Contents for MELSEC iQ-R-R00CPU
Page 2: ......
Page 151: ...9 MONITOR FUNCTION 9 1 Real Time Monitor Function 149 9 MEMO ...
Page 323: ...18 SEQUENCE SCAN SYNCHRONIZATION SAMPLING FUNCTION 321 18 MEMO ...
Page 330: ...328 20 ROUTING SETTING 20 3 Precautions MEMO ...
Page 423: ...26 BASIC CONCEPT 26 8 State Transition of the Redundant System 421 26 MEMO ...
Page 1014: ...1012 APPX Appendix 15 Added and Enhanced Functions MEMO ...
Page 1027: ......