Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 46

Hide thumbs Also See for MELSEC iQ-R Series:
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
• 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.
Range of the number of array elements
The maxim number of array elements varies depending on the data type.
Data type
Bit
Word [unsigned]/bit string [16 bits]
Word [signed]
Timer
Counter
Retentive timer
Double word [unsigned]/bit string [32 bits]
Double word [signed]
Single-precision real number
Time
Long counter
Long retentive timer
Long timer
Double-precision real number
String
String [Unicode]
4 LABELS
44
4.4 Arrays
Specification example
bLabel1[0]
bLabel1[D0]
bLabel1[uLabel2]
bLabel1[5+4]
INC
wLabel3
MOV
K1234 uLabel4[wLabel3]
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.
Setting range
1 to 2147483648
1 to 1073741824
1 to 536870912
1 to 2147483648  String length
1 to 1073741824  String length

Advertisement

Table of Contents
loading

Table of Contents