Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual page 44

Function blocks
Table of Contents

Advertisement

Function Block Specifications
Note
Note INT, DINT, LINT, UINT, UDINT, or ULINT can be used as the vari-
able data type.
• With an equation (for ST language programming only)
Example: a[b+c], where b and c are variables
Note Equations can contain only arithmetic operators (+, − , *, and /).
An array is a collection of data elements that are the same type of data. Each
array element is specified with the same variable name and a unique index.
(The index indicates the location of the element in the array.)
A one-dimensional array is an array with just one index number.
Example: When an internal variable named SCL is set as an array variable
with 10 elements, the following 10 variables can be used:
SCL[0], SCL[1], SCL[2], SCL[3], SCL[4], SCL[5], SCL[6], SCL[7], SCL[8], and
SCL[9]
SCL
0
WORD variable
1
WORD variable
2
WORD variable
Specify SCL[3] to access this data element.
3
WORD variable
4
WORD variable
5
WORD variable
6
WORD variable
7
WORD variable
8
WORD variable
WORD variable
9
Use an internal array variable when specifying the first or last of multiple
words in an instruction operand to enable reusing the function block if an inter-
nal variable with a AT property cannot be set for the operand and an external
variable cannot be set. Prepare an internal array variable with the number of
elements for the required size, and after setting the data in each array ele-
ment, specify the first or last element in the array variable for the operand.
Example:
Function block definition
Variable
SCL
W ORD[10]
Algorithm
SCL- BODY
LD P_ On
MOV #0000 SC
SCL[0]
MOV &0 SC
SCL[1]
MOV #0300 SC
SCL[2]
MOV &4000 SC
SCL[3]
SCL S SC
SCL[0]
D
Settings for variable SCL as an array
variable with element numbers 0 to 9.
Instance
SCL
EN
ENO
S
D
SCL
Specifying this array element
0
#0000
in the SCL instruction is the
1
&0
same as specifying the first
2
#0300
address.
3
&4000
Write the operand data to
the array variables.
Specify the beginning of the
array in the SCL instruction.
Section 2-1
100
29

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