Object ‘Action’

Symbol:

Implement more program code in an action. You can implement this program code as the base implementation in another language. The 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 Project ‣ Add Object ‣ Action .

Add Action

Name

Name of the action

Implementation language

List box of implementation language

Input support when generating inheriting POUs

When you doing object-oriented programming and using the inheritance (keyword EXTENDS) of POUs, you can get support as follows:

When you insert an action, a property, a method, or a transition below a POU derived from a base POU, the Add … dialog opens. Then the input field for the name extends to a list box. The list box contains a valid selection from the actions, properties, methods, or transitions available in the base POU. Now you can, for example, easily accept a method of the base POU and then adapt it to the derived function of the POU.

Methods and properties with the access modifier PRIVATE are not listed here because they are also not inherited. Methods and properties with the access modifier PUBLIC automatically get a blank access modifier field when accepting into the derived POU, which means the same thing functionally.

Example

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