6-11
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-2 POUs (Program Organization Units)
6
6-2-5 Details on Function Blocks
Refer to Function Block Calls in ST Language Statement on page 6-100 for details.
]
The specifications for variables in function blocks are given below.
Variable Designations for Function Blocks
Variables Number Specification
Input variables
*1
1 to 64 Input variables are used as input arguments within the function block. They can-
not be changed inside the function block.
• When the function block 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 Opera-
tion That Applies to Both Functions and Function Blocks.
• You can specify to detect when the variable changes to TRUE or changes to
FALSE.
• You can access and change the values from outside the function block. Access
these values using the following format: InstanceName.InputVariableName.
*2
Output vari-
ables
*3
1 to 64 Output variables are used as output arguments from the function block.
• The output parameters are set to the values of the output variables at the end
of function block execution.
• You cannot specify a constant or a variable with constant attribute for an output
parameter.
• 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 can access the values of output variables from outside of the function
block. Access these values with the following format: InstanceName.Output-
VariableName. However, you cannot write values directly to an output variable.
In-out variables 0 to 64 In-out variables are used as inputs to and outputs from the function block. They
can be changed inside the function block.
• The value of an in-out parameter is passed to an in-out variable and the value
of the in-out variable is then passed to the in-out parameter.
• 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 block, the value of
the in-out parameter changes at that time.
• You cannot omit in-out parameters.
Internal vari-
ables
No limit Internal variables are used for temporary storage within a function block.
• The values of internal variables are retained regardless of whether the function
block is executed.
• Internal variables can have Retain attributes.
• You cannot access the values of internal variables from outside of the function
block.
Input
variable
Output
variable
In-out variable
Input parameter
Output parameter
Value is assigned.
Value is assigned.
Variable assignment
itself is passed.
Variable assignment itself is passed.
In-Out variable
In-out parameter In-out parameter
Function block definition name
or instruction name
Internal
variables
Instance Name