12
Function Blocks
Section 1-2
If internal variables are not used, if processing will not be affected, or if the
internal variables are used in other locations, the same instance name can be
used at multiple locations in the program.
Some precautions are required when using the same memory area. For
example, if the same instance containing a timer instruction is used in more
than one program location, the same timer number will be used causing coil
duplication, and the timer will not function properly if both instructions are exe-
cuted.
Registration of Instances
Each instance name is registered in the global symbol table as a file name.
P_On
1.0
&10
CONTROL
EN ENO
ON_TIME
OFF_TIME
&20
CASCADE_01
P_On
1.1
&10
CONTROL
EN ENO
ON_TIME
OFF_TIME
&15
CASCADE_02
P_On
1.2
&8
CONTROL
EN ENO
ON_TIME
OFF_TIME
&7
CASCADE_03
Function Block Definition
Example: CONTROL
Algorithm
Variables
Instance
CASCADE_02
Algorithm
Internal and I/O
variables
Instance
CASCADE_01
Algorithm
Internal and I/O
variables
Instance
CASCADE_03
Algorithm
Internal and I/O
variables
Cyclic task 0
Cyclic task 1
Example:
There are 3 FB
instances and each
has its own I/O and
internal variables.
P_On
1.0
&130
CONTROL
EN ENO
PARA_1
PARA_2
&100
CASCADE
P_On
1.1
&150
CONTROL
EN ENO
PARA_1
PARA_2
&50
CASCADE
P_On
1.2
&200
CONTROL
EN ENO
PARA_1
PARA_2
&100
CASCADE
Function block definition
Example: CONTROL
Algorithm
Variables
Instance
CASCADE
Algorithm
Internal and I/O
variables
Cyclic task 0
Cyclic task 1
The same instance can be
used at multiple locations.
a
b
c
sample FB [FunctionBlock1]
N/A[Auto]
Program
Instance (sample) of function block definition A
The instance is registered in the
global symbol table with the instance
name as the symbol name.
Name
Data type
Address/
value
The function block definition
name is registered after FB in
square parentheses [ ].
Instance name
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...