23
Converting Function Block Definitions to Library Files
Section 1-4
Function Block Holding
Area Words (H512 to
H1535)
The Function Block Holding Area words are allocated from H512 to H1535.
These words are different to the standard Holding Area used for programs
(H000 to H511) and are used only for the function block instance area (inter-
nally allocated variable area). These words cannot be specified as instruction
operands. They are displayed in red if input when a function block is not being
created. Although the words can be input when creating a function block, an
error will occur when the program is checked. If this area is specified not to be
retained in the Function Block Memory Allocation Dialog Box, turn the power
ON/OFF or clear the area without retaining the values when starting opera-
tion.
1-4
Converting Function Block Definitions to Library Files
A function block definition created using the CX-Programmer can be stored as
a single file known as a function block definition file with filename extension
*.cxf. These files can be reused in other projects (PLCs).
1-5
Usage Procedures
Once a function block definition has been created and an instance of the algo-
rithm has been created, the instance is used by calling it when it is time to
execute it. Also, the function block definition that was created can be saved in
a file so that it can be reused in other projects (PLCs).
1-5-1
Creating Function Blocks and Executing Instances
The following procedure outlines the steps required to create and execute a
function block.
1,2,3...
1.
First, create the function block definition including the algorithm and vari-
able definitions in ladder program or ST language. Alternatively, insert a
function block library file that has been prepared in advance.
Note
(a) Create the algorithm entirely with variable names.
(b) When entering the algorithm in ladder programming language,
project files created with versions of CX-Programmer earlier than
Ver. 5.0 can be reused by reading the project file into CX-Pro-
grammer Ver. 5.0 or higher and copying and pasting useful parts.
(c) Existing ladder programming can be automatically turned into a
function block using
Edit - Function Block (ladder) generation.
2.
When creating the program, insert copies of the completed function block
definition. This step creates instances of the function block.
3.
Enter an instance name for each instance.
tim_b
tim_a
ENO
TIMX tim_a OFF_TIME
tim_b
TIMX tim_b ON_TIME
tim_a
ENO
Project
Project
Save
Read
Function block definition
Example: CLOCK_PULSE
Function block definition
Example: CLOCK_PULSE
1. Algorithm
1. Algorithm
Function block
definition file (.cxf)
TIMX tim_a OFF_TIME
TIMX tim_b ON_TIME
tim_a
TIMER
tim_b
TIMER
ON_TIME
INT
OFF_TIME
INT
Name
Type
Internal
Internal
Input
Input
2. Variable Definitions
Usage
tim_a
TIMER
tim_b
TIMER
ON_TIME
INT
OFF_TIME
INT
Name
Type
Internal
Internal
Input
Input
2. Variable Definitions
Usage
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: ......