You can create a function to perform any task, such as control an oven, and then drag it from the Solution Explorer and drop it into another function. Any function, therefore, can be used as a UDFB,
In addition to its Ladder code, a UDFB may include any of the following:
Input and output tags to transfer values into and out of the function.
Local tags, which only exist within that function.
Global tags, structs, and arrays.
Defining UDFB Tags
Select the function in the Solution Explorer tree.
In the Tag window, click the tab of that function.
Click the FunctionIN ScopeScope type.
Name |
Definition |
Global Scope |
Tags that you create and link to Data Types. The Global scope property means that you can use Global tags throughout your program, in both your HMI and Ladder applications. |
Local Scope |
Tags that you create within a specific Ladder function. They are only visible and available within that function. This means that, if your application requires, you can use the same tag names in different functions. Note that Local tags cannot: - retain value - be used in HMI applications - be seen in On-Line mode |
Note |
You can convert a local tag to global, or global to local, by right-clicking it in the Tag Window and selecting the desired option |
Name |
Definition |
FunctionIn Scope |
You can assign the FunctionIn property to a Local tag of any Data Type in order to transfer values into the function it belongs to. When the function is dragged into another function as a UDFB, it appears on the left of the function as an input parameter. Note that FunctionIN tags cannot: - retain value - be used in HMI applications - be seen in On-Line mode |
FunctionOut Scope |
You can assign the FunctionOut property to a Local tag of any Data Type in order to transfer values out of the function it belongs to. When the function is dragged into another function it appears on the right of the function as an output parameter. Note that FunctionOut tags cannot: - retain value - be used in HMI applications - be seen in On-Line mode |
Click the Add Tag icon and create the tag.
Use the same method to add FunctionOut Tags.
Drag & Drop the UDFB into the desired function, then link tags to the FunctionIN and FunctionOut parameters. Note that you can display the parameter description by mousing over it, as is shown in Starting Temp in the image below.
Nesting
UniLogic supports 8 levels of nested functions.
This means that a function can contain (call) encapsulated functions as shown in the following diagram.
Each function may contain up to 10 Function in parameters and 10 Function out parameters, and may contain up to 256 bytes of local tags of any Data Type.
|
If you are connected to the Internet, you can access this UniLogic tutorial: