Omron CX-PROGRAMMER V8.1 Operation Manual page 92

Function blocks/ structured text
Table of Contents

Advertisement

Section 2-6
Precautions for Instructions with Operands Specifying the First or Last of Multiple
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.
67

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac ws02-cxpc1-v8Sysmac cx-programmer 8.1

Table of Contents