Implementing function commands – Yokogawa PC-Based MX100 User Manual

Page 484

Advertising
background image

8-10

IM MX190-01E

Implementing Function Commands

Program Example 3

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

//////////////////////////////////////////////////////////////
// DARWIN sample for command
#include <stdio.h>
#include "DAQDARWIN.h"
//////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
int rc; //return code
DAQDARWIN comm; //discriptor
char line[BUFSIZ];
#ifdef WIN32
HMODULE pDll; //DLL handle
//callback
DLLOPENDARWIN openDARWIN;
DLLCLOSEDARWIN closeDARWIN;
DLLRUNCOMMANDDARWIN runCommandDARWIN;
//laod
pDll = LoadLibrary("DAQDARWIN");
//get address
openDARWIN = (DLLOPENDARWIN)GetProcAddress(pDll,
"openDARWIN");
closeDARWIN = (DLLCLOSEDARWIN)GetProcAddress(pDll,
"closeDARWIN");
runCommandDARWIN = (DLLRUNCOMMANDDARWIN)GetProcAddress(pDll,
"runCommandDARWIN");
#endif //WIN32
//connect
comm = openDARWIN("192.168.1.11", &rc);
//run
sprintf(line, "DS%d" DAQDARWIN_MODE_OPE);
rc = runCommandDARWIN(comm, line);
//disconnect
rc = closeDARWIN(comm);
#ifdef WIN32
FreeLibrary(pDll);
#endif
return rc;
}
//////////////////////////////////////////////////////////////

8.2 Programming - DARWIN/Visual C -

Advertising