How to Enter a Function
Enter the function you want to use
There are two methods to enter a function in the Structured Text program.
-
Method 1: Use the Function/Function Block window. (Use this method if you don’t know the function name yet.)
-
Method 2: Type in the function name directly. (This method is quicker if you already know the function name.)
Step | Action |
---|---|
1 |
In the Program window, select F/FB Select from the right-click menu as shown below or press the F10 key.
|
2 |
The Function/Function Block window opens.
|
3 |
The function is displayed in the program.
|
In the following example, the INT_TO_DINT function is entered.
After you typed in the first character ‘I’, the following list pops up.
This list includes the functions, function blocks, variables and key words that their name starts with the character ‘I’. This list becomes shorter if you enter more characters. You can type in the entire function name or select the function from the list as shown in the right.
The INT_TO_DINT function is entered.
Use the function you entered
You may have noticed there was a little difference in the display after the function was entered by Method 1 or Method 2.
Entered by Method 1
Entered by Method 2
If you move the mouse cursor over the function, XG5000 displays the default format of the function as reference as shown below.
When you use a function, you must use the same data type suggested for each input and output.
The output of a function can be assigned to a variable or used in a formula.
Example 1:
The output is assigned to a variable.
Example 2:
The output is a used in a formula.
The ‘IN:=‘ for inputs can be eliminated. The followings are valid expressions.
LP304D-5