Function Blocks in ST Programs
Function blocks are blocks of code that define a type of Logic behavior or calculation. As they provide a specific Logic behavior or calculation, they can be used in ST programs and other Logic programs. This means you can save time when coding your ST programs as if there are function blocks (default or custom) that provide the Logic or calculations that you require in your program, you can attach the function block instead of recreating the code. Function blocks act as 'building blocks' that you can use to create your programs.
Each function block has inputs, an internal data structure that defines the Logic that is provided by the function block, and outputs.
You can define a built-in function block within an ST program. The function block will use inputs to perform a specified calculation, then write the results to outputs. If you enter a function block within an ST program, the function block is only available to that ST program. For more information, see Built-In Function Blocks.
Alternatively, you can define a function block in a Structured Text Library or in a Function Block Library. The Libraries can be used over and over again in your Logic programs. This means you can define the function block once in an ST Library or Function Block Library and use it in as many programs as you wish (see Using Libraries in ST Programs).
For information on the required syntax when entering a function block in an ST program, please refer to Built-In Function Blocks.