Function Blocks
Define function blocks in the
Function Blocks
section of the device in the
Application View
.For function blocks, specify these properties:
Property | Description |
---|---|
Comment | Plain text |
Description | Rich text |
In-line | For Ladder Diagram (LD) function blocks, duplicates the code of a function block
for each instance used in the application, providing a faster execution time.
In-line LD function blocks increase the size of the application TIC code. To use an in-line LD function block in another LD function block, known as nested
blocks, set the In-line property for both blocks to True .
|
Language | (Read-only) Programming language of the program organization unit (POU) |
Name | Name of the function block. Function block names are limited to eight (8)
characters beginning with a letter or single underscore followed by letters, digits,
and single underscores. Names cannot be reserved words, defined words, or data
types. Use unique names for POUs within a project. |
Type | (Read-only) Type of POU. Possible values are program, user-defined function, or
user-defined function block. |
Perform these tasks for function blocks:
Task | Procedure |
---|---|
Add function blocks |
|
Set properties of function blocks | In the Application View , right-click the function block, and then click
Properties . |
Copy and paste function blocks | Copying and pasting a function block includes local variables and local defined
words.
|
Rename function blocks | In the Application View , right-click the function block, then click
Rename , and then type a name for the function block. |
Delete function blocks | In the Application View , right-click the function block, and then click
Delete
TIP:
When deleting a function
block, save the project before making subsequent changes.
|
TIP:
When adding function blocks, define parameters.
Function blocks can have a maximum of 32 parameters (inputs and outputs). When defining
parameters, consider these limitations:
- Parameter names are limited to 32 characters and must begin with a letter or single underscore followed by letters, digits, and single underscores. Do not use reserved words, defined words, or data types for names. Use unique names for the parameters of a function block.
- Possible data types for parameters are BOOL, DINT, REAL, TIME, MESSAGE
- For Message type variables, string capacity is limited to 255 characters
Provide Feedback