![F.W. Bell 5200 Series Скачать руководство пользователя страница 52](http://html1.mh-extra.com/html/f-w-bell/5200-series/5200-series_instruction-manual_3058270052.webp)
Information for Remote Operation of 5200 Gaussmeter
There are 2 DLL files which should be installed from the F.W. Bell website: libusb0.dll and usb5100.dll.
Note: These files allow communication with the 5200 by higher level programming languages such as various types of C, C++ or C#, VisualBasic or
development programs like LabView, Agilent VEE, or TestPoint which can make calls to a DLL file. The function definitions are given near the bottom
of this page.
There are 3 functions in the usb5100.dll you will need to call to communicate with the 5200.
1. The first is "openUSB5100" and returns a 4 byte integer (unsigned long in C) which is the USB handle for the device being communicated with.
You may communicate with more than one 5200, but you will need to keep track of the handle for each unit because the handle must be passed to
the other 2 functions when calling them.
Example: Call "
openUSB5100
" and it should return a value, for example 10203045 or some other number.
2. The second function is the one you will use to do all other communication, except for closing the session with the 5200.
It is
"
scpiCommand" and requires 4 arguments to be passed when calling.
a. The USB ID number assigned when the device was opened initially. (the handle returned by openUSB5100)
b. The SCPI command string. (the text string for the desired command as given in the user manual Remote Operation and SCPI command
sections)
c. Pointer to the object where you want the response returned to. (this should be a pointer to a string variable)
d. Maximum response string length. Default is 80 and this should be good for most applications.
Example:
scpiCommand(102030405, *IDN?, pointer to ResponseString variable, 80)
3. The third function will close the USB session with the 5200.
It is "closeUSB5100" and does not return anything.
Example:
closeUSB5100(102030405)
Below are the function definitions for these:
FWB5180.h
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the USB5100_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// USB5100_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef USB5100_EXPORTS
#define USB5100_API __declspec(dllexport)
#else
#define USB5100_API __declspec(dllimport)
#endif
extern "C" USB5100_API unsigned int openUSB5100(void);
extern "C" USB5100_API void closeUSB5100(unsigned int fwb5000ID);
extern "C" USB5100_API int scpiCommand(unsigned int usbID,
char* cmd, char* result, int len);
4-3