AoeWriteControlCommand

Sends a command to the device through ADS over EtherCAT (AoE).

Syntax

KsCommandStatus AoeWriteControlCommand(
     int SlaveId,
     int Port,
     WORD AoeState,
     WORD DeviceState,
     BYTE* Value,
     int Length
);

Parameters

SlaveId: the slave index. This index value is automatically assigned by the KINGSTAR master when the EtherCAT network starts, based on the physical connection order. The first device connected directly to the master is assigned Index 0, followed by Index 1, Index 2, and so on. These indexes remain consistent within the slave array even if devices are added, removed, or reconnected. Please refer to the use cases in HotConnect, Repair, and Restart for more details.

Port: the EtherCAT slave port.

AoeState: the AoE state in which the command runs.

DeviceState: the device state in which the command runs. The state varies between devices.

Value: Pointer to the value to run the command.

Length: the length in byte of the value to run the command.

Return value

Returns the KsCommandStatus structure.

Usable EtherCAT states

ecatPreOP, ecatSafeOP, ecatOP

Example

Copy
/*
*    ADS state:
*    Invalid = 0,
*    Idle = 1,
*    Reset = 2,
*    Init = 3,
*    Start = 4,
*    Run = 5,
*    Stop = 6,
*    SaveConfig = 7,
*    LoadConfig = 8,
*    PowerFailure = 9,
*    PowerGood = 10,
*    Error = 11,
*    Shutdown = 12,
*    Suspend = 13,
*    Resume = 14,
*    Config = 15,
*    Reconfig = 16,
*    Maxstates = 17,
*/
BYTE byteData = 1;
Command = WaitForCommand(5, TRUE, AoeWriteControlCommand(0, 0x1070, 5, 0, &byteData, 1));

Requirements

  RT Win32
Minimum supported version 4.0 4.0
Header ksapi.h ksapi.h
Library KsApi_Rtss.lib KsApi.lib

See also

AoeReadCommand

AoeReadSdoObject

AoeReadWriteCommand

AoeWriteCommand

AoeWriteSdoObject