29
Function Block Specifications
Section 2-1
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]
Note
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:
SCL
0
1
2
3
4
5
6
7
8
9
Specify SCL[3] to access this data element.
WORD variable
WORD variable
WORD variable
WORD variable
WORD variable
WORD variable
WORD variable
WORD variable
WORD variable
WORD variable
Settings for variable SCL as an array
variable with element numbers 0 to 9.
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
SCL
EN ENO
S D
100
SCL
WORD[10]
SCL
0
#0000
1
&0
2
#0300
3
&4000
Function block definition
Instance
Variable
Algorithm
Specifying this array element
in the SCL instruction is the
same as specifying the first
address.
Write the operand data to
the array variables.
Specify the beginning of the
array in the SCL instruction.
Summary of Contents for CS1-H Series
Page 3: ...iv...
Page 5: ...vi...
Page 7: ...viii TABLE OF CONTENTS...
Page 15: ...xvi Application Precautions 4...
Page 151: ...136 Procedures Section 3 2...
Page 153: ...138 Data Types Appendix A...
Page 177: ...162 External Variables Appendix C...
Page 181: ...166 Revision History...