3 - 30 3 - 30
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
Arrays are not limited to just numeric values. There are types of array that handle
characters as well. In addition, when using numeric type arrays, different types of
numbers can be defined, such as integers, single-precision, and double-precision.
(For details on defining variable types, see the sections for the DEFINT, DEFSNG, and
DEFDBL instructions.)
A$(n)
• • • • • • • • Indicates character array A$.
A%(n) • • • • • • • • Indicates integer array A%.
A!(n)
• • • • • • • • Indicates single-precision array A!.
A#(n)
• • • • • • • • Indicates double-precision array A#.
3.8.1 Number of dimensions in an array
The dimension of an array refers to the number of indices within the parentheses. The
following example shows one to three dimensional arrays.
Three-dimensional
(x,y,z)
C(0,2,1)
C(1,2,1)
C(2,2,1)
C(0,2,2)
C(1,2,2)
C(2,2,2)
A$(0)
A$(1)
A$(2)
B(0,0)
B(0,1)
B(0,2)
B(1,0)
B(1,1)
B(1,2)
B(2,0)
B(2,1)
B(2,2)
C(0,0,0)
C(0,1,0)
C(0,2,0)
C(1,0,0)
C(1,1,0)
C(1,2,0)
C(2,0,0)
C(2,1,0)
C(2,2,0)
One-dimensional
A$(x)
Two-dimensional
B(x,y)
…
…
…
For arrays with two dimensions or more, data can be extracted quickly by combining
meanings.
For example, before specifying the array A(x,y), the following is defined.
X=1
• • • • PLC
y=1
• • • • Production
schedule
X=2
• • • • Factory
automation
controller
y=2
• • • • Produced quantity
X=3
• • • • Robot
y=3
• • • • Achievement %
Then assign the data as
shown:
The number of PLCs produced to
A(1,2)
The target production of robots to
•
•
•
•
A(3,1)
This way, data can be extracted only
by matching the values in the
parentheses to the target elements
to reference the target data .
It is possible to define a maximum of 255 dimensions.
REMARK
It is possible to define a maximum of 255 dimensions, but in actuality, the amount of
memory may not be enough when too many dimensions are reserved.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...