Mitsubishi Electric MELSEC iQ-R Series User Manual page 503

Process cpu module
Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

Defining arrays
■Array elements
When an array is defined, the number of elements, or the length of array, must be determined. For the range of the number of
elements, refer to the following.
Page 503 Range of the number of array elements
■Dimension number of multidimensional array
Up to three-dimensional array can be defined.
■Definition format
The following table lists definition format.
The range from the array start value to the array end value is the number of elements.
Number of
Format
array
dimensions
One dimension
Array of primitive data type/structure name (array start value..array end value)
[Definition example] Bit (0..15)
Two
Array of primitive data type/structure name (array start value..array end value, array start value..array
dimensions
end value)
[Definition example] Bit (0..1, 0..15)
Three
Array of primitive data type/structure name (array start value..array end value, array start value..array
dimensions
end value, array start value..array end value)
[Definition example] Bit (0..2, 0..1, 0..15)
■Initial value
One initial value can be set for a single array definition. (Different initial values cannot be set for each element.)
The same initial value is stored in all the array elements.
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
Specification example
Constant
bLabel1[0]
Device
bLabel1[D0]
Label
bLabel1[uLabel2]
Expression
bLabel1[5+4]
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.
Remarks
• For the primitive data type:
Page 497 Primitive data type
• For the structure name:
Page 504 Structures
28 LABELS
501
28.5 Arrays
28

Advertisement

Table of Contents
loading

Table of Contents