RtecatSetHeartbeat

RtecatSetHeartbeat configures the heartbeat settings.

Syntax

Copy
RTECAT_ERROR RtecatSetHeartbeat(
  [in]    RTECAT_HANDLE MainDevice,
  [in]    BOOL Enable,
  [in]    double Timeout
);

Parameters

[in] MainDevice

A handle to a MainDevice. To retrieve the corresponding handle, use RtecatOpenMainDevice.

[in] Enable

TRUE to enable the heartbeat function, FALSE otherwise.

[in] Timeout

The time in which you need to use RtecatPulseHeartbeat to notify E-CAT Fieldbus that your application is running properly. The unit of time is second.

Return Values

The function returns an RTECAT_ERROR value. If the function succeeds, it returns ecatErrNoError. If the function fails, it returns a different value.

Possible return values:

Return value Meaning

ecatErrNoError

The function succeeded.

ecatErrWrongParameter

One of the following conditions occurred:

  • Parameter MainDevice is invalid.
  • Parameter Timeout is smaller than or equal to 0 when Enable is TRUE.

ecatErrMainDeviceNotReady

The MainDevice instance does not exist.

Remarks

RtecatSetHeartbeat is a synchronous function that executes immediately and returns a result upon completion.

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 RtecatSetHeartbeat), users must use RtecatPulseHeartbeat to periodically notify the corresponding MainDevice within the specified time period. Otherwise, the MainDevice will assume the connection is lost and then close the EtherCAT link, which works like an RtecatStop.

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

RtecatApi.h

RtecatApi_W64.lib (Windows), RtecatApi.lib (RTSS)

See Also: