Control Methods

Control methods have a return value of type ET_Result. The return value is processed by the state machine. Depending on the return value, the state machine changes to the next state as defined in the state machine diagram. Control methods are typically used to implement application-specific program code.

  • ET_Result.Done: The internal state machine changes to the next state as defined in the state machine diagram.

  • ET_Result.Error: The internal state machine changes to the Error state.

  • ET_Result.Busy: The state is not changed and the method is called again.

In the state machine diagrams, control methods are represented in the lower part of the yellow boxes (also refer to the chapter Legend of State Machine Diagrams).

Control method

Description

The method is called:

Preparing

PreparingEnable

PreparingExecute

These methods implement program code which is executed once after enabling the function block. For example, the verification and latching of input parameters.

Once

Activating

This method implements program code for binding the resource. For example, the establishing of a connection to a remote server.

As long as the return value is Busy.

Executing

This method implements program code for monitoring the bound resource or for processing the specific task of the function block. For example, the monitoring of a connection or the data transmission to a connected remote server.

As long as the return value is Busy.

Deactivating

This method implements program code for unbinding a resource. For example, the closing of a connection to a remote server.

When disabling the function block as long as the return value is Busy.

Aborting

This method implements program code for aborting an ongoing process of the function block. For example, stopping a movement before the target position was reached.

As long as the return value is Busy.

WaitForExecute

This method implements program code for monitoring a bound resource while waiting for the command to execute the specific task of the function block. For example, the monitoring of the status of a connection while waiting for the command to send data.

As long as the return value does not indicate Error and there is no rising edge at the input i_xExecute.

WaitForReset

This method implements program code for updating additional outputs while waiting for the command to reset the detected error state. For example, to provide diagnostic information for the required error reset.

As long as there is no rising edge at the input i_xErrorQuit.

Resetting

This method implements program code for acknowledging an error state. For example, to clean-up the buffer after an erroneous data transmission.

As long as the return value indicates Busy and the input i_xEnable is TRUE.

The table provides an overview of which control method is provided by which base function block:

Method

FB_EnableReady

FB_Execute

FB_ExecuteAbort

FB_EnableExecute

FB_EnableExecuteQuit

Preparing

X

X

X

-

-

PreparingEnable

-

-

-

X

X

PreparingExecute

-

-

-

X

X

Activating

X

-

-

X

X

WaitForExecute

-

-

-

X

X

Executing

X

X

X

X

X

Deactivating

X

-

-

X

X

Aborting

X

-

X

X

X

WaitForReset

-

-

-

-

X

Resetting

-

-

-

-

X