FbusIO_SendMsg Statement

Sends an explicit message to a Fieldbus device and returns the reply.

Syntax
FbusIO_SendMsg (busNumber, deviceID, msgParam, sendData(), recvData())

Parameters

busNumber
Integer expression representing the fieldbus system number. This number is always 16 and is the ID of the bus connected to the fieldbus master board on the PC side of the controller.
deviceID
Integer expression representing the device’s fieldbus ID
msgParam
Integer expressions representing message parameters. Cannot be used for DeviceNet.
sendData
Specify the data to be sent to the device as an array of Byte type. This array must be dimensioned to the number of bytes to send. If there are no bytes to send, specify 0.
recvData
Specify the data to be received from the device as an array of Byte type. This array will automatically be redimensioned to the number of bytes received.

Description
FBusIO_SendMsg is used to query one Fieldbus device. Refer to the device manufacturer for information on messaging support.

Note


This command will only work if the Fieldbus Master option is active.


See Also
FbusIO_GetBusStatus, FbusIO_GetDeviceStatus

FbusIO_SendMsg Statement Example

' Send explicit message to DeviceNet device
Byte sendData(5)
Byte recvData(0)
Integer i

sendData(0) = &H0E  ' Command
sendData(1) = 1     ' Class
sendData(3) = 1     ' Instance
sendData(5) = 7     ' Attribute
' msgParam is 0 for DeviceNet
FbusIO_SendMsg 16, 1, 0, sendData(), recvData()
' Display the reply
For i = 0 to UBound(recvData)
  Print recvData(i)
Next i

' Send message to Profibus device
Byte recvData(0)
Integer i

' msgParam is the service number
FbusIO_SendMsg 16, 1, 56, 0, recvData()
' Display the reply
For i = 0 to UBound(recvData)
  Print recvData(i)
Next i