Function Blocks
Define function blocks in the Function Blocks section of the
Application View
. Program
functions using Function Block Diagram (FBD), Ladder Diagram (LD), Sequential Function
Chart (SFC), or Structured Text (ST).Specify these properties for function blocks:
Property | Description |
---|---|
Code Generation | |
Generate Debug Info | Generate information required for debugging using step-by-step
execution. |
Generate Monitoring Symbol | For graphical program organization units (POUs), generate
information required for graphically displaying the output values of
elements when debugging or simulating |
Instance Symbols Extra Bytes | Size of memory reserved for each function block instance for
adding symbols monitoring information during updates. A string-type
output takes up 260 bytes. |
Info | |
Comment | Plain text |
Description | Rich text |
Full Name | (Read-only) Full name of the function indicating the project and
controller to which it belongs |
Language | (Read-only) Programming language of the POU |
Name | (Read-only) Name of the function block. Function block names are
limited to 128 characters beginning with a letter followed by
letters, digits, and single underscores. The last character for a
function block name must be a letter or digit; function block names
cannot end with an underscore character. Reserved words, defined
words, or data types, such as elementary, structures, or arrays are
not valid names. The same type of elements within a scope must have
unique names. |
Order | Position of the function block within the execution order |
Password Protected | (Read-only) Function is protected by a password controlling its
access |
Path | (Read-only) Complete path where the function block files are
stored on the computer |
When adding function blocks, define required parameters. Function blocks can have a
maximum of 128 parameters (inputs and outputs). When defining parameters, consider these
limitations:
- Parameter names are limited to 128 characters beginning with a letter followed by letters, digits, and single underscores. The last character for a parameter name must be a letter or digit; parameter names cannot end with an underscore character. Reserved words, defined words, or data types, such as elementary, structures, or arrays are not valid names. The same type of elements within a scope must have unique names.
- Possible data types for parameters are BOOL, SINT, USINT, BYTE, INT, UINT, WORD, DINT, UDINT, DWORD, LINT, ULINT, LWORD, REAL, LREAL, TIME, DATE, STRING, Array types, Structure types, Function blocks
- For String type variables, string capacity is limited to 255 characters excluding the terminating null character (0), a byte for the current length of the string, and a byte for the maximum length of the string
- For user defined addresses, the format is hexadecimal and the value ranges from 1 to FFFF
- For dimensions, example: [1..10] for a one dimensional array, [1..4,1..7] for a two dimensional array
For instances of function blocks, reset the initial values defined for individual
instances.
Perform these tasks for function blocks:
Task | Procedure |
---|---|
Add a function block |
|
Export a function block | Export function blocks as exchange files (*.pxf). Also export
functions from libraries.
|
Add a function block from an exchange file | Import function blocks previously saved as exchange files (.pxf).
For program organization units (POUs) in version control, check
out the POU before importing the exchange file (.pxf). Avoid renaming POUs in the Import dialog box when importing.
Renaming may cause a loss of function block references or broken
binding links for local variables. Rename the POU from the
Application View .
|
Reset the initial values of function block instances |
|
Copy and paste a function block |
|
Rename a function block | In the Application View , right-click the
function block, then select Rename , and then
type a name for the function block. |
Delete a function block | In the Application View , right-click the
function block, and then select
Delete . |
Provide Feedback