46
Instance Specifications
Section 2-3
Accessing Function Block
Instance Area from the
User Program
If the user program contains an instruction to access the function block
instance area, an error will be displayed in the Compile Tab of the Output Win-
dow of CX-Programmer if the following operations are attempted.
• Attempting to write during online editing (writing not possible)
• Executing program check (Selecting
Compile
from the Program Menu or
Compile All PLC Programs
from the PLC Menu)
Example: If W0 to W511 is specified as the non-retained area of the function
block instance area and W0.00 is used in the ladder program, an error will
occur when compiling and be displayed as “ERROR: [omitted]...- Address -
W0.00 is reserved for Function Block use].
Note
The allocations in the function block instance area for variables are automati-
cally reallocated when a variable is added or deleted. A single instance
requires addresses in sequence, however, so if addresses in sequence can-
not be obtained, all variables will be allocated different addresses. As a result,
unused areas will be created. If this occurs, execute the optimization opera-
tion to effectively use the allocated areas and remove the unused areas.
Comments
A comment of up to 30,000 characters long can be entered.
Creating Multiple
Instances
Calling the Same Instance
A single instance can be called from multiple locations. In this case, the inter-
nal variables will be shared.
Making Multiple Instances
Multiple instances can be created from a single function block definition. In
this case, the values of internal variables will be different in each instance.
Example: Counting Product A and Product B
Prepare a function block definition called Down Counter (CTD) and set up
counters for product A and product B. There are two types of programs, one
for automatic operation and another for manual operation. The user can
switch to the appropriate mode of operation.
In this case, multiple instances will be created from a single function block.
The same instance must be called from multiple locations.
Applicable areas
C (Counter Area) Counter Flag (1 bit) or counter PVs (16 bits)
Allocated words
(default)
C206 to C255 Counter Flag (1 bit) or counter PVs (16 bits)
Item
Contents
FB
EN ENO
1.0
P_Off
3.0
W0.00
W0
512
Program
Compile error
Instance data area
Non Retain
Retain
Timers
Counters
Start
address
Size
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: ......