Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4COM)  1.26.2
IFieldbus Interface Reference

Inherits IDispatch.

Collaboration diagram for IFieldbus:
Collaboration graph

Classes

struct  IoDiagnosis
 
struct  IoFieldbusMasterInfo
 
struct  IoFieldbusSlaveInfo
 
struct  IoHandle
 

Public Types

Public Member Functions

HRESULT ReadFieldbusMasterInfo ([out, retval] struct IoFieldbusMasterInfo *masterInfo)
 
HRESULT UpdateFieldbusIo ()
 
HRESULT ReadFieldbusSlaveInfos ([out, retval] SAFEARRAY(struct IoFieldbusSlaveInfo)*slaveInfos)
 
HRESULT WriteFieldbusIoAsByteArray ([in] BSTR slaveAddress, [in] IoFieldbusArea area, [in] LONG byteOffset, [in] LONG byteLength, [in] SAFEARRAY(BYTE) data)
 
HRESULT ReadFieldbusIoAsByteArray ([in] BSTR slaveAddress, [in] IoFieldbusArea area, [in] LONG byteOffset, [in] LONG byteLength, [out, retval] SAFEARRAY(BYTE)*data)
 

Detailed Description

Definition of the IFieldbus interface which gives access to the data of a single fieldbus.

The IIo interface contains various methods of accessing different input and output subsystems of the mlpi target. It makes it possible to read and write data from the connected fieldbus hardware.

Definition at line 72 of file IFieldbus.idl.

Member Enumeration Documentation

This enumeration defines types of fieldbus master.

Enumerator
FIELDBUS_MASTER_GENERIC 

Generic, not all feature are supported.

FIELDBUS_MASTER_ONBOARD_IO 

Onboard I/O.

FIELDBUS_MASTER_INLINE_IO 

Online I/O.

FIELDBUS_MASTER_PROFIBUS_DP 

Profibus DP.

FIELDBUS_MASTER_SERCOS_III 

Sercos.

FIELDBUS_MASTER_FAST_IO 

FastIO.

FIELDBUS_MASTER_PROFINET 

ProfiNet.

FIELDBUS_MASTER_DEVICENET 

DeviceNet.

FIELDBUS_MASTER_ETHERNET_IP 

EthernetIP.

FIELDBUS_MASTER_ETHERNET_NETX 

Ethernet.

Definition at line 76 of file IFieldbus.idl.

This enumeration defines the I/O areas 'Input' and 'Output' of a fieldbus device.

Enumerator
IO_AREA_INPUT 

Input area of a fieldbus device.

IO_AREA_OUTPUT 

Output area of a fieldbus device.

Definition at line 92 of file IFieldbus.idl.

Member Function Documentation

HRESULT IFieldbus::ReadFieldbusMasterInfo ( [out, retval] struct IoFieldbusMasterInfo masterInfo)

This function returns miscellaneous information about the given master. This includes its name, diagnosis, type, number of slaves, etc...

Parameters
[out]masterInfoReturns a struct with miscellaneous information about the given master.
Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
// read masterlist and print out each master
string[] masterList = (string[])connection.Io.ReadFieldbusMasterList();
foreach (string master in masterList)
{
Console.WriteLine("-> " + master);
// read more detailed information about the master
IoFieldbusMasterInfo masterInfo = connection.Io.Fieldbuses[master].ReadFieldbusMasterInfo();
Console.WriteLine(" Name: " + masterInfo.name);
Console.WriteLine(" NumSlaves: " + masterInfo.numberOfSlaves.ToString());
Console.WriteLine(" Type: " + masterInfo.type.ToString());
Console.WriteLine(" Diagnosis: 0x" + masterInfo.Diagnosis.flags.ToString("X"));
}
Note:
This method maps to the mlpiCore function mlpiIoReadFieldbusMasterInfo, where you can find further documentation.
HRESULT IFieldbus::UpdateFieldbusIo ( )

This method performs a bus cycle in order to update the fieldbus I/Os of all attached slaves of the fieldbus.

Returns
Return value indicating success (>=0) or error (<0).
Note:
This method maps to the mlpiCore function mlpiIoUpdateFieldbusIo, where you can find further documentation.
HRESULT IFieldbus::ReadFieldbusSlaveInfos ( [out, retval] SAFEARRAY(struct IoFieldbusSlaveInfo)*  slaveInfos)

This function returns an array with information about the slaves connected to this fieldbus. This includes their names, diagnoses, types, etc...

Parameters
[out]slaveInfosReturns an array of structs. Each array element holds information about a slave.
Returns
Return value indicating success (>=0) or error (<0).
Example C#:
// read masterlist and print out each master
string[] masterList = (string[])connection.Io.ReadFieldbusMasterList();
foreach (string master in masterList)
{
Console.WriteLine("-> " + master);
// read more detailed information about the master
IoFieldbusMasterInfo masterInfo = connection.Io.Fieldbuses[master].ReadFieldbusMasterInfo();
Console.WriteLine(" Name: " + masterInfo.name);
Console.WriteLine(" NumSlaves: " + masterInfo.numberOfSlaves.ToString());
Console.WriteLine(" Type: " + masterInfo.type.ToString());
Console.WriteLine(" Diagnosis: 0x" + masterInfo.Diagnosis.flags.ToString("X"));
// read more detailed information about each connected slave
IoFieldbusSlaveInfo[] slavelist = (IoFieldbusSlaveInfo[])connection.Io.Fieldbuses[master].ReadFieldbusSlaveInfos();
foreach (IoFieldbusSlaveInfo slave in slavelist)
{
Console.WriteLine(" -> " + slave.name);
// read more detailed information about the master
Console.WriteLine(" Name: " + slave.name);
Console.WriteLine(" Address: " + slave.address);
Console.WriteLine(" Diagnosis: 0x" + slave.Diagnosis.flags.ToString("X"));
Console.WriteLine(" NumInputs: " + slave.numberOfInputs);
Console.WriteLine(" NumOutputs: " + slave.numberOfOutputs);
}
}
Note:
This method maps to the mlpiCore function mlpiIoReadFieldbusSlaveInfo, where you can find further documentation.
HRESULT IFieldbus::WriteFieldbusIoAsByteArray ( [in] BSTR  slaveAddress,
[in] IoFieldbusArea  area,
[in] LONG  byteOffset,
[in] LONG  byteLength,
[in] SAFEARRAY(BYTE)  data 
)

This function writes a byte array to the fieldbus slave.

Parameters
[in]slaveAddressName or address of the slave to access.
[in]areaArea to access (IO_AREA_INPUT, IO_AREA_OUTPUT).
[in]byteOffsetByte offset based on zero (e.g. IB0).
[in]byteLengthNumber of bytes to write from data array to the memory area.
[in]dataInput data array of bytes to be written to the given area at given byteOffset. Array has to be greater than or equal to byteLength.
Returns
Return value indicating success (>=0) or error (<0).
Note:
This method maps to the mlpiCore function mlpiIoWriteFieldbusIo, where you can find further documentation.
HRESULT IFieldbus::ReadFieldbusIoAsByteArray ( [in] BSTR  slaveAddress,
[in] IoFieldbusArea  area,
[in] LONG  byteOffset,
[in] LONG  byteLength,
[out, retval] SAFEARRAY(BYTE)*  data 
)

This function reads a byte array from the fieldbus slave.

Parameters
[in]slaveAddressName or address of the slave to access.
[in]areaMemory area to access (IO_AREA_INPUT, IO_AREA_OUTPUT).
[in]byteOffsetByte offset based on zero.
[in]byteLengthNumber of bytes to read from area.
[out]dataReturns an array of bytes containing the requested memory area. Index starts at 0.
Returns
Return value indicating success (>=0) or error (<0).
Note:
This method maps to the mlpiCore function mlpiIoReadFieldbusIo, where you can find further documentation.

The documentation for this interface was generated from the following file: