Implementing function commands – Yokogawa PC-Based MX100 User Manual

Page 408

Advertising
background image

7-10

IM MX190-01E

Implementing Function Commands

Program Example 3

This program switches DARWIN to operation mode. The program executes the DS
command of DARWIN communication function.

//////////////////////////////////////////////////////////////
// DARWIN sample for command
#include <stdio.h>
#include "DAQDARWIN.h"
//////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
int rc; //return code
CDAQDARWIN daqdarwin; //class
char line[BUFSIZ];
//connect
rc = daqdarwin.open("192.168.1.11");
//run
sprintf(line, "DS%d" DAQDARWIN_MODE_OPE);
rc = daqdarwin.runCommand(line);
//disconnect
rc = daqdarwin.close();
return rc;
}
//////////////////////////////////////////////////////////////

Description

Creating the Message
sprintf(line, "DS%d" DAQDARWIN_MODE_OPE);
Stores the DS0 (switch to operation mode) command message of the DARWIN
communication function in the line array.

The constant “operation mode” is used to specify operation mode.

Sending Messages
runCommand(line)
Sends the command message and receives the response. This member function

adds a terminator to the message and sends it.

7.3 Programming - DARWIN/Visual C ++ -

Advertising