EasyManua.ls Logo

Mitsubishi Electric MELSEC iQ-R-R6SFM - Page 381

Mitsubishi Electric MELSEC iQ-R-R6SFM
1028 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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
w
Label1 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

Table of Contents

Related product manuals