Library.SetHeartbeat Method

Configures the heartbeat settings of a MainDevice.

Namespace:  IntervalZero.MaxRT.Ecat.Api.NetApi
Assembly:  IntervalZero.MaxRT.Ecat (in IntervalZero.MaxRT.Ecat.dll) Version: 1.0.0.0 (File version: 1.0.1)

Syntax

Copy
public EcatErrorCode SetHeartbeat(
    EcatHandle mainDevice,
    bool enable,
    double timeout
)

Parameters

mainDevice

Type: EcatHandle
A handle to a MainDevice. To retrieve the corresponding handle, use CreateMainDevice or OpenMainDevice.

enable

Type: Bool
true to enable the heartbeat function, false otherwise.

timeout

Type: Double
The time, in seconds, within which you need to use PulseHeartbeat to notify E-CAT Fieldbus that your application is running properly.

Return Value

EcatErrorCode is thrown when any of these errors occur:

Error code Meaning

ecatErrNoError

The function succeeded.

ecatErrWrongParameter

One of the following conditions occurred:

  • Parameter mainDevice is invalid.
  • Parameter timeout is less than or equal to 0 when enable is true.

ecatErrMainDeviceNotReady

The MainDevice instance does not exist.

Remarks

The E-CAT Fieldbus uses a heartbeat mechanism to detect if the connection between the MainDevice instance and user applications is lost. When heartbeat is enabled (through SetHeartbeat), users must use PulseHeartbeat to periodically notify the corresponding MainDevice within the specified time. Otherwise, the MainDevice will assume the connection is lost and close the EtherCAT link, which works like Stop.

See Also: