How to Enter a Function Block
Enter the function block you want to use
There are two methods to enter a function block in the Structured Text program.
-
Method 1: Use the Function/Function Block window. (Use this method if you don’t know the function block name yet.)
-
Method 2: Type in the function block name directly. (This method is quicker if you already know the function block 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 Select Variable window opens.
|
4 |
The Select Variable window opens.
|
5 |
The instance of the function block is displayed in the program.
|
In the following example, the TMR function block is entered.
Step | Action |
---|---|
1 |
After you typed in the first character ‘T’, the following list pops up.
This list includes the functions, function blocks, variables and key words that their name starts with the character ‘T’. This list becomes shorter if you enter more characters. You can type in the entire function block name or select the function block from the list as shown in the right.
|
2 |
After you enter the function block name, the Select Variable window opens.
|
3 |
The Select Variable window opens.
|
4 |
The instance of the function block is displayed in the program.
|
Use the function block you entered
XG5000 displays the data type defined for each input(s) indicated with ‘:=‘ and output(s) indicated with ‘=>’.
A variable or constant can be assigned to each input. Only a variable can be assigned to each output.
All input(s) must be used in the program, but any output can be omitted. The following expressions are all valid.
The instance of the function block is a variable. The input(s) and output(s) associated with the function block become member variables for the instance.
For example, when the instance of the TMR function block is entered in the program, the following 5 member variables are created automatically.
Each member variable can be accessed with the name in the following format.
<Variable name of the instance><Member variable name>
The example programs in the left can be written as follows.
The member variables can be used in the program like this.
LP304D-6