GetIOByIndex
Gets the information from a specified real or simulated I/O module.
Syntax
KsError GetIOByIndex(
int Index,
SlaveStatus* Details
);
Parameters
Index: the index of the device in the I/O list. Indexes are zero based. Aliases affect this parameter.
Details: pointer to the SlaveStatus structure to receive the detailed information.
Return value
If the function succeeds, it returns errNoError
, otherwise an error code. For more information about the error code, see the KsError list.
Remarks
GetIObyIndex can only be called once a link is established and started.
Usable EtherCAT states
ecatOP
Example
VOID PrintModuleInformation(INT Index) {
SlaveStatus moduleStatus = { 0 };
int nRet = GetIOByIndex(Index, &moduleStatus);
RtPrintf("Device %d %s: Vendor 0x%x, Product 0x%x, Revision 0x%x, Serial 0x%x\n",
Index, moduleStatus.Name, moduleStatus.VendorId, moduleStatus.ProductCode,
moduleStatus.RevisionNumber, moduleStatus.SerialNumber);
RtPrintf("Address: Auto %d, Fixed %d, Alias %d\n", moduleStatus.SlaveId,
moduleStatus.PhysAddress, moduleStatus.AliasAddress);
RtPrintf("PDO: Input len %d, Output len %d, Index offset 0x%x\n",
moduleStatus.InputLength, moduleStatus.OutputLength, moduleStatus.VariableIndexOffset);
RtPrintf("State %d, Cycle time %d\n", moduleStatus.State, moduleStatus.CycleTime);
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksapi.h | ksapi.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also