Arrays - Mitsubishi Electric R16MTCPU Programming Manual

Hide thumbs Also See for R16MTCPU:
Table of Contents

Advertisement

Arrays

An array represents a consecutive aggregation of same data type labels as a single name.
Primitive data types and structures can be defined as arrays.
The maxim number of array elements varies depending on the data type.
One-dimensional array
Label name
Index
bLabel1
[0]
[1]
·
[n]
Defining arrays
■Array elements
When an array is defined, the number of elements, or the length of array, must be determined.
■Definition format
The following table lists definition format examples up to three dimensions.
The range from the array start value to the array end value is the number of elements.
Number of array
Format
dimensions
One dimension
Array of primitive data type/structure name (array start value..array end value)
[Definition example] Bit (0..2)
Two dimensions
Array of primitive data type/structure name (array start value..array end value, array start value..array
end value)
[Definition example] Bit (0..2, 0..1)
Three dimensions
Array of primitive data type/structure name (array start value..array end value, array start value..array
endvalue, array start value..array end value)
[Definition example] Bit (0..2, 0..1, 0..3)
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]
Two-dimensional array
Label name
Index
bLabel2
[0,0]
[0,1]
[0,n]
·
[1,0]
[1,1]
·
·
·
·
[m,0]
[m,n]
Remarks
An integer can be specified.
A word device, double-word device, decimal constant, or hexadecimal constant can be specified. (Data
register(D), Link register(W), and Motion register(#) devices can be used.)
Remarks
• Refer to primitive data type
for details on primitive data
type (Page 126
Primitive data type)
• Refer to structures for
details on structures
(Page 128 Structures)
4 OPERATION CONTROL PROGRAMS
4.4 Labels
4
127

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R64mtcpuMelsec iq-r seriesR32mtcpu

Table of Contents