Add a user-defined function block
Use
Project Organizer
to create a user-defined function block (UDFB) for structured text (ST), ladder diagram (LD), or function block diagram (FBD) programs in Micro800
controllers.When adding a UDFB, select the programming language based on the type of application you are developing. Each programming language supported in
FactoryTalk Design Workbench
is targeted for different types of applications and programming styles. In general:- LD executes simple Boolean logic, timers, and counters the fastest.
- FBD and ST are more efficient for more advanced process instructions available in the languages.
UDFBs define business logic for complex mathematical computations. After creating a UDFB, it operates the same way as any other instruction blocks within a program, and can be used to call other types of blocks or other UDFBs. Once a UDFB is defined in a project, like other built-in instructions in
FactoryTalk Design Workbench
, it appears in the User-defined
category in Toolbox
.When comparing the execution times for the same UDFB written in different programming languages, there are fundamental differences on how the different languages are compiled and executed.
UDFB names and parameters must comply with the following rules:
- A UDFB name can contain up to 128 characters.
- A UDFB can contain a total of up to 128 parameters.
- A UDFB cannot contain more than 20 input parameters or 20 output parameters.
To add a user-defined function block
- InProject Organizer, expandAssets.
- Right-clickUser-Defined Function Blocks, and then selectNew user-defined function block.
- InNew user-defined function block, enter the UDFB name, select the UDFB type, and enter the description as needed.
- SelectCreate.
Provide Feedback