6-19
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-2 POUs (Program Organization Units)
6
6-2-6 Details on Functions
The specifications for variables in functions are given below.
Variable Designations for Functions
Variables Number Specification
Input variables 0 to 64 Input variables are used as input arguments within the function. They cannot be
changed inside the function.
• When the function is executed, the input variables are set to the values of the
input parameters.
• You can specify either constants or variables for input parameters.
• Omitting Input Parameters:
Refer to information on operation when parameters are omitted in 6-2-7 Oper-
ation That Applies to Both Functions and Function Blocks.
• Unlike function blocks, you cannot specify to detect changes to TRUE or
FALSE.
• You cannot access the values of input variables from outside of the function.
• Some of the instructions provided by OMRON can have varying numbers of
input variables, but you cannot make a user-created function that has a vary-
ing number of input variables.
Output variables 0 to 64 Output variables are used as output arguments from the function.
• The output parameters are set to the values of the output variables at the end
of function execution.
• You cannot specify a constant or a variable with constant attribute for an out-
put parameter.
• At least one BOOL output variable (including ENO and the return value) is
required.
• You can omit output parameter connections.
If you omit an output parameter, the value of the output variable is not
assigned to any parameter.
• You cannot access the values of output variables from outside of the function.
In-out variables 0 to 64 In-out variables are used as inputs to and outputs from the function. They can be
changed inside the function.
• In-out parameters (variable designations) are directly passed to or received
from the in-out variables.
• You cannot specify a constant or a variable with constant attribute for an in-out
parameter.
• If you change the value of an in-out variable within a function, the value of the
in-out parameter changes at that time.
• You cannot omit in-out parameters.
• You cannot access the values of in-out variables from outside of the function.
Internal vari-
ables
No limit Internal variables are used for temporary storage within a function.
• The value is not retained after execution is completed.
• You cannot access the values of internal variables from outside of the function.
Function name or instruction name
Input
variable
Output
variable
In-out variable
Input parameter Output parameter
In-out parameter
Value is assigned.
Value is assigned.
Variable assignment
itself is passed.
Variable assignment
itself is passed.
Internal
variables
In-out variable
In-out parameter
Value is assigned.
Return value parameter
Return value
Function name or instruction name