Using a User Function
Step | Action |
---|---|
1 |
In the Project window panel locate the Ladder Main Task program.
|
2 |
Open the Program file under the Ladder program.
|
3 |
Insert User Function into your Ladder Diagram program. Select a Ladder line panel such as L0.
|
4 |
Select the pane in the Ladder Diagram and press keyboard key F10 . Alternate Method: press the Function/FB toolbar option to highlight it. Select the pane in the Ladder Diagram program to add function block.
|
5 |
Select your PLC's name under Category, then select the User Function under Function List. In the example below, the PLC name is 'NewPLC'.
|
6 |
Add Input and Output variables to your function.
|
7 |
After finishing the process of adding the Function, press Check Program to check your code for errors.
|
Step | Action |
---|---|
1 |
In the Project window panel locate the Structured Text Main Task program.
|
2 |
Open the Program file under the Structured Text program.
|
3 |
In the Structured Text code, press keyboard key F10 to add the User Function to the program. Alternate Method: Press the Function/FB toolbar option.
|
4 |
Select your PLC's name under Category, then select the User Function under Function List. In the example below, the PLC name is 'NewPLC'.
|
5 |
Function call is added to your code. Replace commented sections with variables of the type in the comment.
Example of newly inserted Function instance. It contains comments to be replaced with values or variables of that type.
Example of finished Function call. It contains the variables of the correct type in the Function call. Make sure to add the “;” at the end. The newly inserted code is missing it. Note:
*This example has no outputs in the function call only the return value of the function. |
6 |
After finishing the process of adding the Function, press Check Program to check your code for errors.
|
LM121-2