Using a Function Block (FB) within another FB's program is called "nesting FBs." You can nest FBs up to 16 levels. However, you cannot use recursive calls (using an FB as an instruction within the same FB).
*1. Recursive call from the first instance of FB_0000
*2. The 17th level (nesting is allowed up to 16 levels)
Registering Nested FB as a Package
When registering a nested FB as a package, you can select whether or not to register the FBs used as instructions together in the package.
When you drag and drop a nested FB to a package, a dialog box appears with a list of FBs used as instructions. Select the FBs to include in the same package, and click [OK].
For example, you are registering FB_0 to a package, and FB_1 is used as an instruction in FB_0.
If you register FB_1 together:
The program for FB_1, which is used as an instruction, is also registered in the package at the same time. When you unpack FB_0, both, FB_0 and FB_1 are added to the Screen List. You can use the unpacked FB_0's logic program without modification.
If you don't register FB_1 together:
In FB_0, the instruction portion where it is calling FB_1 remains, but the FB_1 itself (logic program) does not exist. When you unpack FB_0, FB_0 is added to the Screen List, but FB_1, which is called in the program, doesn't exist. In order for FB_0 to work properly, you need to create FB_1 again.
The missing FBs with only the instructions in the logic program retain the number of operands. However, D operand is reduced to 1, and all others are displayed as S operands.
This is useful when you want to call an FB (FB_1) and replace the process performed by the FB. For example, if you are using FB_1 whose output bit flickers based on the number of seconds specified in FB_0, you can register multiple FB_1s with different flickering units to packages. You can modify FB_0 easily by unpacking suitable FB_0 as necessary.