Converting Function Block Definitions To Library Files; Usage Procedures; Creating Function Blocks And Executing Instances - Omron WS02-CXPC1-V9 - V9 Operation Manual

Table of Contents

Advertisement

Converting Function Block Definitions to Library Files

Function Block Holding
Area Words (H512 to
H1535)
1-4

Converting Function Block Definitions to Library Files

1-5

Usage Procedures

1-5-1

Creating Function Blocks and Executing Instances

1,2,3...
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.
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).
Project
Function block definition
Example: CLOCK_PULSE
1. Algorithm
tim_b
TIMX tim_a OFF_TIME
tim_a
TIMX tim_b ON_TIME
ENO
2. Variable Definitions
Usage
Name
Type
Internal
tim_a
TIMER
Internal
tim_b
TIMER
Input
ON_TIME
INT
OFF_TIME
INT
Input
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).
The following procedure outlines the steps required to create and execute a
function block.
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.
Project
Save
Read
Function block
definition file (.cxf)
Section 1-4
Function block definition
Example: CLOCK_PULSE
1. Algorithm
tim_b
TIMX tim_a OFF_TIME
tim_a
TIMX tim_b ON_TIME
ENO
2. Variable Definitions
Usage
Name
Type
Internal
tim_a
TIMER
Internal
tim_b
TIMER
Input
ON_TIME
INT
OFF_TIME
INT
Input
23

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cx-programmer 9Sysmac ws02-cxpc1-v9

Table of Contents