Table of Contents

Class EtherCatSlave

Namespace
TwinSharp.EtherCAT
Assembly
TwinSharp.dll

Represents an EtherCAT slave device and provides methods to interact with it via TwinCAT ADS.

public class EtherCatSlave
Inheritance
EtherCatSlave
Inherited Members

Constructors

EtherCatSlave(AdsClient, uint)

Initializes a new instance of the EtherCatSlave class, representing an EtherCAT slave device.

public EtherCatSlave(AdsClient client, uint adress)

Parameters

client AdsClient

An ADS client that is connected to the EtherCAT master.

adress uint

The index of the EtherCAT slave device within the network. Typically starts at 1001.

Properties

CrcError

Allows the CRC error counters of the individual ports (A, D, B and C) of a slave to be read. Equivavalent to the function block FB_EcGetSlaveCrcErrorEx.

public ST_EcCrcErrorEx CrcError { get; }

Property Value

ST_EcCrcErrorEx

Identity

Can be used to read the CANopen identity of an individual EtherCAT slave device. Equivavalent to the function block FB_EcGetSlaveIdentity.

public ST_EcSlaveIdentity Identity { get; }

Property Value

ST_EcSlaveIdentity

State

Allows the EtherCAT status and the Link status of an individual EtherCAT slave to be read. Equivavalent to the function block FB_EcGetSlaveState.

public ST_EcSlaveState State { get; }

Property Value

ST_EcSlaveState

Methods

CoeReadAny<T>(uint, uint)

Read any object from the CoE object dictionary.

public T CoeReadAny<T>(uint index, uint subIndex)

Parameters

index uint
subIndex uint

Returns

T

Type Parameters

T

CoeWriteAny(uint, uint, object)

Write any object to the CoE object dictionary.

public void CoeWriteAny(uint index, uint subIndex, object value)

Parameters

index uint
subIndex uint
value object

RequestState(EcDeviceState)

With this function a slave can be requested to a specified EtherCAT state. Equivavalent to the function block FB_EcReqSlaveState.

public void RequestState(EcDeviceState state)

Parameters

state EcDeviceState