Program - Omron CX-PROGRAMMER V8.1 Operation Manual

Function blocks/ structured text
Table of Contents

Advertisement

Statement Descriptions

Program

Variable type
Input variable
Input variable
Input variable
Input variable
Input variable
Output variable
Output variable
Internal variable
Instance_FB(FB_IN1:=IN1,FB_IN2:=IN2,FB_IN3:=IN3,
FB_OUT1=>OUT1,FB_OUT3=>OUT3)
• Different order of entry:
Instance_FB(EN:=A,FB_IN1:=IN1,FB_OUT1=> OUT1,FB_IN2:=IN2,
FB_OUT2=>OUT2,FB_IN3:= IN3,FB_OUT3=> OUT3,ENO=>B)
■ Example of Entry Method 2
In this example, only parameter variables (including constants) of a new
instance are entered.
Instance_FB(IN1, IN2, IN3, OUT1, OUT2, OUT3)
Instance_FB(IN1, IN2, IN3, OUT1)
• The arguments and return values must be listed in a fixed order.
Input variable 1, Input variable 2, ..., Output variable 1, Output variable 2,
...
• The input variables' arguments must be at the beginning of the list, or just
after the EN variable if the EN variable is listed.
• An output variable can be omitted if the data is not actually being used
and the output variable is not in the middle of the list of output variables.
Example: Instance_FB(IN1, IN2, IN3, OUT1, OUT3)
In this case, the OUT3 at the end of the list would return the value from
FB_OUT2.
• The EN and ENO data cannot be entered as an argument or return value.
• Specification method 1 cannot be used together with specification method
B in the same function block call statement.
■ Example 2
In the following example, function block 1 calls function block 2, which calcu-
late the average value by calling a function block from within a function block.
Instance_FB1
FB1
Average_FB( input1 := data1, input2 := data2,
input3 := data3, average => AVG );
Function Block 1
• Variable Table
Variable name
EN
BOOL
data1
INT
data2
INT
data3
INT
bCheck
BOOL
ENO
BOOL
AVG
INT
Average_FB
FUNCTION BLOCK
Called function block definition:
Function block 2
The data1, data2, and data3 values are
FB1 (ST)
passed to input1, input2, and input3.
The average value is
returned in AVG.
Average_FB is an instance name with data type FUNCTION BLOCK.
Data type
Section 5-5
FB2 (ST)
average := ( input1 + input2 + input3 ) / 3 ;
Passage to/from FB2
---
Passed to input1
Passed to input2
Passed to input3
---
---
Received from average
---
165

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac ws02-cxpc1-v8Sysmac cx-programmer 8.1

Table of Contents