85
Procedures
Section 3-2
Note
Function block definitions are not displayed in the default settings for OMRON
FB Library files (.cxf). To display definitions, select the
Display the inside of
FB
option in the function block properties. (Select the OMRON FB Library file
in the project workspace, right-click, select
Properties
,
and select the
Dis-
play the inside of FB
option in the General Tab.)
3-2-3
Defining Function Blocks Created by User
A function block is defined by registering variables and creating an algorithm.
There are two ways to do this.
• Register the variables first and then input the ladder program or structure
text.
• Register variables as they are required while inputting input the ladder
program or structure text.
Registering Variables First
Registering Variables in
the Variable Table
The variables are divided by type into five sheets in the variable table: Inter-
nals, Inputs, Outputs, Input-Output, and Externals.
These sheets must be switched while registering or displaying the variables.
1,2,3...
1.
Make the sheet for the type of variable to be registered active in the vari-
able table. (See note.) Place the cursor in the sheet, right-click, and per-
form either of the following operations:
• To add a variable to the last line, select
Insert Variable
from the pop-
up menu.
• To add the variable to the line above or below a line within the list, se-
lect
Insert Variable - Above
or
Below
from the pop-up menu.
Note
The sheet where a variable is registered can also be switched
when inserting a variable by setting the usage (N: Internals, I: In-
puts, O: Outputs, E: Externals, P: In Out).
The New Variable Dialog Box shown below will be displayed.
•
Name:
Input the name of the variable.
•
Data Type:
Select the data type.
•
Usage:
Select the variable type.
•
Initial Value:
Select the initial value of the variable at the start of oper-
ation.
•
Retain:
Select if the value of the variable is to be maintained when the
power is turned ON or when the operating mode is changed from
PROGRAM or MONITOR mode to RUN mode. The value will be
cleared at these times if
Retain
is not selected.
Variable table
Ladder program
Summary of Contents for CX-PROGRAMMER V8.1
Page 3: ...iv...
Page 5: ...vi...
Page 7: ......
Page 15: ...xvi...
Page 19: ...xx...
Page 25: ...xxvi Application Precautions 4...
Page 26: ...Part 1 Function Blocks...
Page 27: ......
Page 153: ...128 Procedures Section 3 2...
Page 154: ...Part 2 Structured Text ST...
Page 155: ......
Page 159: ...134 CX Programmer Specifications Section 4 2...
Page 205: ...180 Procedures Section 6 1...
Page 207: ...182 System defined external variables supported in function blocks Appendix A...
Page 229: ...204 Revision History...
Page 230: ......