Functions
Define functions in the
Functions
section of the device in the Application
View
.For functions, specify these properties
Property | Description |
---|---|
Comment | Plain text |
Description | Rich text |
Language | (Read-only) Programming language of the program organization unit (POU) |
Name | Name of the function. Function 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 functions:
Task | Procedure |
---|---|
Add a function |
|
Set properties for a function | In the Application View , right-click the function, and then click
Properties . |
Copy and paste a function | Copying and pasting a function includes local variables and local defined
words.
|
Delete a function | In the Application View , right-click the function, and then click
Delete .
TIP:
When deleting a function,
save the project before making subsequent changes.
|
Rename a function | In the Application View , right-click the function, then click Rename ,
and then type a name for the function. |
TIP:
When adding functions, define parameters. Functions can
have a maximum of 32 parameters (31 inputs and one output). 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.
- Possible data types for parameters are BOOL, DINT, REAL, TIME, MESSAGE
- For Message type variables, string capacity is limited to 255 characters
Provide Feedback