FBusIO_SendMsg Method
Description
Sends an explicit message to a Fieldbus device and returns the reply.
Syntax
Sub FBusIO_SendMsg (BusNumber As Integer, DeviceID As Integer, MsgParam As Integer, SendData As Byte(), ByRef RecvData As Byte())
Parameters
- BusNumber
An integer indicating the Fieldbus system number. This number must be 16, which is the ID of the bus connected to the Fieldbus master board on the PC side of the controller. - DeviceID
An integer indicating the Fieldbus ID of the device. - MsgParam
An integer expression indicating the message parameter. This is not available for DeviceNet. - SendData
Specifies the data to send to the device as a byte array. This array must be dimensioned to the number of bytes to send. If there are no bytes to send, specify 0. - RecvData
Specifies the data to receive from the device as a byte array. This array will automatically be redimensioned to the number of bytes received.
Remarks
Note
This method will only work if the Fieldbus Master option is active.
See Also
FBusIO_GetBusStatus Method, FBusIO_GetDeviceStatus Method, IsOptionActive Method
FBusIO_SendMsg Use Example
VB Examples:
'Send explicit message to DeviceNet device
Dim recvData() as Byte
Dim sendData(6) as Byte
Array.Clear(sendData, 0, sendData.Length)
sendData(0) = 14 'Command
sendData(1) = 1 'Class
sendData(3) = 1 'Instance
sendData(5) = 7 'Attribute
' MsgParam is 0 for DeviceNet
m_spel.FbusIO_SendMsg(16, 1, 0, sendData, recvData)
' Send explicit message to Profibus device
Dim recvData() As Byte;
m_spel.FbusIO_SendMsg(16, 1, 56, Nothing, recvData);
C# Example:
// Send explicit message to DeviceNet device
byte[] sendData, recvData;
byte[] sendData = new byte[6];
Array.Clear(sendData, 0, sendData.Length);
sendData[0] = 14; //Command
sendData[1] = 1; //Class
sendData[3] = 1; //Instance
sendData[5] = 7; //Attribute
//MsgParam is 0 for DeviceNet
m_spel.FbusIO_SendMsg(16, 201, 0, sendData, out recvData);
// Send explicit message to Profibus device
byte[] recvData;
m_spel.FbusIO_SendMsg(16, 1, 56, null, out recvData);