Object ‘Action’¶
Symbol:
In an action, you implement additional program code, which you can further implement as in another language as the base implementation. This base implementation is a function block or a program where you inserted the action.
An action does not have its own declaration and it works with the data from the base implementation. This means that the action uses the input and output variables and the local variables from its base implementation.
Add an Action to a function block or program by clicking .
Name | Name of the action |
Implementation language | Drop-down list of implementation language |
Note
When you do object-oriented programming and want to use inheritance for blocks, you have the following support: When you insert a method, action, etc. below an inherited block, the Add Object dialog box includes a combo box with a list of methods, actions, etc. used in the base block. In this way, you can easily accept a method definition of the base and adapt it accordingly for the inherited method of the block. Methods and attributes with the PRIVATE access modifier are not available in this selection because they should not be inherited. When accepted into the inherited block, methods and attributes with the PUBLIC access modifier automatically have a blank access modifier field. (Functionally, this means the same thing.)
See also
Calling an action
Syntax:
<program>.<action>
or <FB instance>.<action>
To call an action from only within the base implementation, you only have to provide the action name.
Examples
Calling a Reset action from another POU The call is not executed from the base implementation.
Declaration:
PROGRAM PLC_PRG
VAR
Inst : Counter;
END_VAR
Calling a Reset action from an IL POU
CAL Inst.Reset(In := FALSE)
LD Inst.Out
ST ERG
Calling a Reset action from an ST POU
Inst.Reset(In := FALSE);
Erg := Inst.out;
Calling a Reset action from an FBD POU
Note
Actions are used frequently in the SFC implementation language.
See also