Mitsubishi Electric MELSEC iQ-R-R00CPU User Manual page 381

Melsec iq-r series cpu module application user's manual
Table of Contents

Advertisement

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 '[ ]'.
bLabel1 [0]
bLabel2 [0,3]
Label name
Index
The following table lists the types of indexes that can be specified for arrays.
Type
Constant
Device
Label
Expression
• 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.
bLabel1
bLabel2
MOV
• 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.
bLabel3
wLabel1
[0]
Specification example
bLabel1[0]
bLabel1[D0]
bLabel1[uLabel2]
bLabel1[5+4]
INC
wLabel3
K1234 uLabel4[wLabel3]
BMOV
wLabel1 wLabel2
[1]
[2]
[3]
Remarks
An integer can be specified.
A word device, double-word device, decimal constant, or hexadecimal
constant can be specified. (ST, LST, G, and HG cannot be specified.)
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]
Expressions can be specified only in ST language.
K3
wLabel2
[0,0]
[0,1]
[0,2]
[1,0]
[1,1]
[1,2]
[2,0]
[2,1]
[2,2]
[3,0]
[3,1]
[3,2]
[0,3]
[1,3]
[2,3]
[3,3]
22 LABELS
22.5 Arrays
22
379

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents