Owner manual

3-11
IM MX190-01E
MX100 - Visual C
3
Retrieval of Setup Data and Configuration
Program Example 2
This program executes the following three items. This program contains all four
items, but each item can be written and executed separately.
Get the setup data collectively
Configure the setup data collectively.
Set a DC voltage range to the channel
//////////////////////////////////////////////////////////////
// MX100 sample for configuration
#include <stdio.h>
#include "DAQMX.h"
//////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
int rc; //return code
DAQMX comm; //discriptor
//data
MXConfigData configdata;
#ifdef WIN32
HMODULE pDll; //DLL handle
//callback
DLLOPENMX openMX;
DLLCLOSEMX closeMX;
DLLGETCONFIGDATAMX getConfigDataMX;
DLLSETCONFIGDATAMX setConfigDataMX;
DLLSETVOLTMX setVOLTMX;
//laod
pDll = LoadLibrary(ìDAQMX”;
//get address
openMX = (DLLOPENMX)GetProcAddress(pDll, "openMX");
closeMX = (DLLCLOSEMX)GetProcAddress(pDll, "closeMX");
getConfigDataMX = (DLLGETCONFIGDATAMX)GetProcAddress(pDll,
"getConfigDataMX");
setConfigDataMX = (DLLSETCONFIGDATAMX)GetProcAddress(pDll,
"setConfigDataMX");
setVOLTMX = (DLLSETVOLTMX)GetProcAddress(pDll, "setVOLTMX");
#endif //WIN32
//connect
comm = openMX("192.168.1.12" &rc);
//get
rc = getConfigDataMX(comm, &configdata);
//set
rc = setConfigDataMX(comm, &configdata);
//range
rc = setVOLTMX(comm, DAQMX_RANGE_VOLT_20MV, 1, 1, 0, 0, 0,
0, 0);
3.2 Program - MX100/Visual C -