![Omron SYSMAC CX-Programmer 9 Operation Manual Download Page 86](http://html1.mh-extra.com/html/omron/sysmac-cx-programmer-9/sysmac-cx-programmer-9_operation-manual_744241086.webp)
60
Function Block Applications Guidelines
Section 2-5
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-7 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
Input-output variable or internal variable, data type = WORD, array setting
with 10 elements, variable names = filename[0] to filename[9]
• Data Settings and Internal Function Block Processing
• Input-output variables:
Set the input parameter to the address of the first word in the data (ex-
ample: D100). The data (#5C31, #3233, #0000, etc.) is set in D100 to
D109 in advance from the main user program.
• Internal variables:
Use ladder programming within the function block to set data into the
array.
Handling Control Data in Multiple Words
In this example, an array contains the number of words and first source word
(operand S1) for an FREAD instruction.
• Variable table
Input-output variable or internal variable, data type = DINT, array setting
with 3 elements, variable names = read_num[0] to read_num[9]
• Data Settings and Internal Function Block Processing
• Input-output variables:
Set the input parameter to the address of the first word in the data (ex-
ample: D200). The data is set in D200 to D205 in advance from the
main user program.
• Internal variables:
Use ladder programming within the function block to set data into the
array.
• Ladder Programming
Specify the first element of the array
in the instruction operand.
FREAD (
omitted
) (
omitted
) read_num[0] (
omitted
)
Set data in each array element.
Specify the first element
of the array in the instruction
operand.
FREAD (
omitted
) (
omitted
) file_name[0] (
omitted
)
MOV #0000 file_name[2])
MOV #3233 file_name[1]
MOV #5C31 file_name[0]
Specify the first element of the array
in the instruction operand.
FREAD (
omitted
) read_num[0] (
omitted
) (
omitted
)
Set data in each array element.
Specify the first element of the array
in the instruction operand.
FREAD (
omitted
) read_num[0] (
omitted
) (
omitted
)
MOVL &100 read_num[0] (
No._of_words
)
MOVL &0 read_num[1] (
1st_source_word
)
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......