67
Precautions for Instructions with Operands Specifying the First or Last of Multiple
Section 2-6
Array Variables
The result depends on the following conditions.
Size to Be Processed by Instruction Is Fixed
If the size to be processed by the instruction is a fixed operand, and this size
does not match the number of array elements, the CX-Programmer will output
a compile error.
Example: LINE TO COLUMN(064) instruction; COLM
S
D
N
(S: Bit number, D: First destination word, N: Source word)
E.g., COLM
a
b[0]
c
If an array for a WORD data type with 10 array elements is specified in D
when it should be for 16 array elements, the CX-Programmer will output an
error when compiling.
Size to Be Processed by Instruction Is Not Fixed
When the operand size to be processed by the instruction is not fixed (when
the size is specified by another operand in the instruction), make sure that the
number of array elements is the same or greater than the size specified in the
other operand (i.e., size to be processed by the instruction).
Other Operand Specifying Size: Constant
The CX-Programmer will output an error when compiling.
Example: BLOCK TRANSFER: XFER
W
S D
(W: Number of words, S: First source word; D: First destination word)
When
&20
is specified in W, array variable
a
with data type WORD and 10
elements is specified in S, and array variable
b
with data type WORD and 10
elements is specified in D:
XFER
&20
a[0]
b[0]
Even though the array variables a[0] and b[0] are both 10 words, the
XFER(070) instruction will execute transfer processing for the 20 words spec-
ified in W. As a result, the XFER(070) instruction will perform read/write pro-
cessing for the I/O memory area following the number of array elements that
was allocated, as shown in the following diagram.
Therefore, if a[10 elements] is internally allocated words (e.g., H700 to H709),
and b[10 elements] is internally allocated words (e.g., H800 to H809),
XFER(070) will transfer data in words H700 to H719 to words H800 to H819.
In this operation, if another internally allocated variable (e.g., c), is allocated
words in H810 to H819, the words will be overwritten, causing unexpected
operation to occur. To transfer 20 words, make sure that the number of ele-
ments is specified as 20 elements for both array variable
a
and
b
.
Содержание SYSMAC CX-Programmer 9
Страница 2: ......
Страница 4: ...iv ...
Страница 6: ...vi ...
Страница 8: ......
Страница 16: ...xvi ...
Страница 20: ...xx ...
Страница 26: ...xxvi Application Precautions 4 ...
Страница 27: ...Part 1 Function Blocks ...
Страница 28: ......
Страница 154: ...128 Procedures Section 3 2 ...
Страница 155: ...Part 2 Structured Text ST ...
Страница 156: ......
Страница 160: ...134 CX Programmer Specifications Section 4 2 ...
Страница 206: ...180 Procedures Section 6 1 ...
Страница 208: ...182 System defined external variables supported in function blocks Appendix A ...
Страница 230: ...204 Revision History ...
Страница 231: ......