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 index of a slave array. When EtherCAT is started, this index has the same value as the SlaveId, which corresponds to the position of the slave in the network. Please note that after EtherCAT is started in the Operational (Op) state, any addition or removal of slaves from the network will change the position of the slaves in the network (SlaveId). Nevertheless, the index of the slave will remain the same. Newly added devices will be added in the back of the slave array. For all slaves after the change, the index and SlaveId will no longer match. This behavior is only available for physical devices; simulated devices are inapplicable. Please refer to the use cases in EnableHotConnect 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
/*
* 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