Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 66

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

Subprogram control statements
■ Function block call statement
Format
Instance name (input variable1:=variable1,...output
variable1=>variable2,...);
Instance name.input variable1:=variable1;
Instance name();
Variable2:=instance name.output variable1;
The following table lists the symbols used in the arguments of the function block call statements and the expressions that can
be assigned.
Type
VAR_INPUT
VAR_OUTPUT
VAR_IN_OUT
VAR_PUBLIC
The execution result of a function block is stored by specifying an output variable after the instance name with a period "." and
assigning the result to the specified variable.
Function block
Having one input variable and one output variable
Having three input variables and two output variables
■ Function call statement
Format
Function name (variable1,variable2,...);
The execution result of a function is stored by assigning it to a variable.
Function
Having one input variable (example: ABS)
Having three input variables (example: MAX)
Having EN/ENO (except for standard functions)
(example: MAX_E)
Standard function (example: MOV)
A user-defined function which returns no value or a function including VAR_OUTPUT in parameters of the call statement can
be executed as a statement by describing it after ";" (semicolon).
6 STRUCTURED TEXT LANGUAGE
64
6.1 Configuration
Description
Enclose the assignment statements to the input and output variables in '()' after the instance name.
When using multiple variables, delimit individual assignment statements with a comma ','.
List the assignment statements to input and output arguments between function block call
statements.
Description
Attribute
Input variable
None, or RETAIN
Output variable
None, or RETAIN
Input/output variable
None
External variable
None, or RETAIN
FB definition
FB name: FBADD
FB instance name: FBADD1
Input variable1: IN1
Output variable1: OUT1
FB name: FBADD
FB instance name: FBADD1
Input variable1: IN1
Input variable2: IN2
Input variable3: IN3
Output variable1: OUT1
Output variable2: OUT2
Description
Enclose arguments in "()" following the function name.
When using multiple variables, delimit them with a comma ",".
Example
Output1 := ABS( Input1 );
Output1 := MAX( Input1 , Input2 , Input3 );
Output1 := MAX_E( boolEN , boolENO , Input1 , Input2 , Input3 );
boolENO := MOV( boolEN , Input1 , Output1 );
(The execution result of the function is ENO, and the first argument (variable1) is EN.)
Symbol used
Assignable expression
:=
All expressions
=>
Only variables
:=
All expressions
Cannot be specified.
Example
FBADD1(IN1:= Input1 );
Output1 := FBADD1.OUT1;
FBADD1(IN1:= Input1 ,IN2:= Input2 ,IN3:= Input3 );
Output1 := FBADD1.OUT1;
Output2 := FBADD1.OUT2;

Advertisement

Table of Contents
loading

Table of Contents