6-23
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-2 POUs (Program Organization Units)
6
6-2-7 Operation That Applies to Both Functions and Function Blocks
You can omit both input and output parameters.
* You can access the input and output variables of a function block from outside of the function block (but only
within the same program) with InstanceName.VariableName. However, you cannot access the input and output
variables of a function from outside the function.
The following operation occurs when there is an error in an input parameter, output parameter, or in-out
parameter.
Errors in Input Parameters
If an error is detected in an input parameter, the function or function block is not executed and ENO
is FALSE. The power flow output is also FALSE, but all other values are retained.
Example:
Operation When Parameters Are Omitted
Operation when omitted
Parameters omitted in FB FUN
Input parameters to input
variables
• When the first time the instance is executed, the
initial value is used.
• Thereafter, the function block is executed with the
previous value (if the input variable is omitted, the
initial value is always used).
The initial value is used for
operation.
Output parameters from
output variables
Can be omitted.
You can access the results of the operation outside
of the instruction by using InstanceName.OutputVari-
ableName.*
You can omit the output
parameter. If it is omitted,
there is no way to retrieve
the result of the operation.
In-out parameters to/from
in-out variables
Cannot be omitted. Cannot be omitted.
Operation for Parameter Errors
FBinstance.Done
Done
Omitted.
Can be specified by using InstanceName.Done.
FBinstance
FB
Variable Table
Variable name Array Data type
x INT [ 1 .. 10 ]
Function
EN
IN1
IN2
ENO
OUT2
x[10]
FALSE
abc Retained.
Example when variable i is outside the
range of the elements in array variable x
x[i]