For more information about the Variable List Settings Guide, please refer to the following.
30.15.4 Function Block [Variable List] Settings Guide
In the Function Block screen editor, use function block (FB) exclusive variables and system variables to create programs.
There are 3 types of FB-specific variables: one type of variables can be used within FBs only, and other 2 types of variables function as operands for Function Block Instructions, passing and receiving FB data to/from logic programs. You create variables in the Function Block screen's variable list, and they can be used within the FB where they were created.
While you can use identical FB's multiple times in a logic program, the operation will be different depending on the setting for [System Settings]-[Logic Program]-[Share Local Variables in Function Blocks].
FB-specific variables are not reset even when FBs are not enabled. Please reset them according to the contents of the program.
Local Variables
Local variables are variables used within FBs only. You cannot write to local variables directly from Logic Screens where FBs are inserted.
You can register up to 512 local variables per FB.
Input Variables/Output Variables
You can use input variables and output variables to pass and receive data between FBs and logic programs. When you insert a FB in the Logic Screen, input variables created in the FB display as S operands, and output variables display as D operands.
You can register up to 63 input variables and 63 output variables per FB.
For operands, specify addresses or variables that match the variable type of input variables or output variables. The values stored in the addresses or variables of S operands are passed to input variables, and used in FBs. Also, the values of output variables in FBs are stored in addresses or variables set for D operands.
You cannot set input variables as D operands (outputs) of logic instructions.
You cannot set output variables as S operands (inputs) of logic instructions.
Notes
When creating or using FBs, please consider the following behaviors for creating logic programs.
FBs are not reset.
When the display unit is switched ON, FBs are not reset even when the conducting state is finished, and variables in FBs retain the last values. Please reset FBs as necessary.
Differences According to the Share Local Variables in Function Blocks Settings
When using an identical FB multiple times in the logic program as instructions, the amount that logic variables are used and the operation of local variables within the FB will depend on the setting for [System Settings]-[Logic Program]-[Share Local Variables in Function Blocks]. Because the behavior of local variables is different, the processing results of the logic program will also be different.
[Share Local Variables in Function Blocks]: When using "Disable", each function block instruction will have its own local variables, which will increase the variable usage every time the instruction is inserted. Enable to Disable: When making this change to the local variable usage type, be careful of the capacity of the logic variables.
30.14.2.1 Checking Memory Usage
The following example describes the differences in behavior according to the settings:
Example:
Prepares a FB (FB_0000) adds 1 every time the instruction is executed. The FB passes a value to the output variable (Output) equal to the value of a local variable (Count) plus 1.
FB_0000 is used twice in the logic program, and the D1 Operand for each is D100 and D2000 respectively.
If Enable is selected,
the amount that the logic variables are used does not increase even if identical FB's (FB_0000) are used multiple times in the logic program.
When the logic program is executed, D100 and D200 increase in an alternating fasion (D100=1, 3, 5, 7, D200=2, 4, 6, 8), and the resulting value will be outoput , will be output every time X100 turns ON. This is because the two function block instructions (FB_0000) used on the logic program write to or read from the same local variable (Count). As such, if an identical FB is used multiple times in the logic program as instructions, you may not see the expected result. When using identical FB's multiple times, make sure they do not execute at the same time, or so that they finish operation with one execution.
If Disable is Selected
The amount of that the logic variables are used increases every time an identical FB (FB_0000) is used in the logic program.
When the logic program is executed, the values increase by one (D100=1, 2, 3, 4, and D200=1, 2, 3, 4) and will be output every time X100 turns ON. This is because the two function block instructions (FB_0000) used in the logic program have a separate local variables (Count). Therefore, the identical FBs do not interfere with each other.