Array Settings For Internal Variables - Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual

Function blocks
Table of Contents

Advertisement

Function Block Applications Guidelines
2-4-4

Array Settings for Internal Variables

Using Array Variables
to Specify First or Last
Word in Multiword
Operands
1,2,3...
44
Note The method for specifying Index Registers for Special I/O Unit allo-
cation addresses requires AT settings to be specified for the first
address of the allocation area. (For details, refer to 2-4-5 Specifying
Addresses Allocated to Special I/O Units.)
• When Auxiliary Area bits that are not pre-registered to external variables
are used, and these bits are registered to global symbols that are not
specified as external variables.
• When setting the first destination word at the remote node for SEND(090)
and the first source word at the local node for RECV(098).
• When the instruction operand specifies the first or last of multiple words,
and internal array variable cannot be specified for the operand (e.g., the
number of array elements cannot be specified).
When specifying the first or last of a range of words in an instruction operand
(see note), the instruction operates according to the address after AT specifi-
cation or internal allocation. (Therefore, the variable data type and number of
elements for the variable are unrelated to the operation of the instruction.) Al-
ways specify a variable with an AT setting or an array variable with a number
of elements that matches the data size to be processed by the instruction.
Note
Some examples are the first source word or first destination word of the
XFER(070) (BLOCK TRANSFER) instruction, the first source word for
SEND(090), or control data for applicable instructions.
For details, refer to 2-5 Precautions for Instructions with Operands Specifying
the First or Last of Multiple Words. Use the following method to specify an array
variable.
1. Prepare an internal array variable with the required number of elements.
Note Make sure that the data size to be processed by the instruction is
the same as the number of elements. For details on the data sizes
processed by each instruction, refer to 2-6 Instruction Support and
Operand Restrictions.
2. Set the data in each of the array elements using the MOV instruction in the
function block definition.
3. Specify the first (or last) element of the array variable for the operand. This
enables specification of the first (or last) address in a range of words.
Examples are provided below.
Handling a Single String of Data in Multiple Words
In this example, an array contains the directory and filename (operand S2) for
an FREAD instruction.
• Variable table
Internal variable, data type = WORD, array setting with 10 elements, vari-
able names = filename[0] to filename[9]
• Ladder programming
MOV #5C31 file_name[0]
MOV #3233 file_name[1]
MOV #0000 file_name[2])
FREAD (omitted) (omitted) file_name[0] (omitted)
Set data in each array element.
Specify the first element
of the array in the instruction
operand.
Section 2-4

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-programmer 5.0Sysmac ws02-cxpc1-e-v50Cs1-hCj1-hCj1m

Table of Contents