9implementing the talker function – Yokogawa PC-Based MX100 User Manual

Page 497

Advertising
background image

9-9

IM MX190-01E

DARWIN - Visual Basic -

9

Implementing the Talker Function

Program Example 4

This program retrieves the system configuration data. The program executes the TS
and CF commands of the DARWIN communication function.

Public Function Main()
Dim lenLine As Long
Dim line As String * 256
'connect
host = "192.168.1.11"
comm = openDARWIN(host, rc)
'talker
rc = runCommandDARWIN(comm, "TS5")
rc = sendTriggerDARWIN(comm)
rc = sendLineDARWIN(comm, "CF0")
Do
rc = receiveLineDARWIN(comm, line, 256, lenLine)
Loop While ((rc = 0) And (Left(line, 1) <> "E")
'disconnect
rc = closeDARWIN(comm)
End Function

Description

Talker
runCommandDARWIN(comm, "TS5")
Sends the TS5 (declares the retrieval of the system configuration data) command

message of the DARWIN communication function and receives the response. This
member adds a terminator to the message and sends it.

sendTriggerDARWIN(comm)
Sends a trigger (device trigger).

Designation of System Configuration Output Format
sendLineDARWIN(comm, "CF0")
Sends the CF0 communication function command (specify the module information

that has been configured for the system). This member adds a terminator to the
message and sends it.

Data Retrieval
receiveLineDARWIN(comm, line, 256, lenLine)
Stores the system configuration data line by line to a 256-byte field. The program
ends when an end mark (E) is returned.

Note

The receiveLine function simply receives the data. The user must write statements for

determining the end of the data.

9.2 Programming - DARWIN/Visual Basic -

Advertising