DME1600
51
Sample Programs
App
Program 3: DEVQUERY function
The following sample program is written in Visual C++. It is a Win32 console application. A
Win32 console application is a Win32 application in which input and output are performed
through text entry rather than through a graphic interface. You can quickly create a Win32
application through simple input and output functions.
// devquery.cpp : Defines the entry point for the console application.
//
// Call the NI-VISA library visa32.dll
//
//
#include "stdafx.h"
#include "visa.h"
//standard include for a Microsoft Visual C++ project
#include "stdio.h"
#include "windows.h"
void main(int argc, char* argv[])
{
// TODO: Add your control notification handler code here
HINSTANCE hUSBTMCLIB; // for USBTMC HANDLE
unsigned long m_defaultRM_usbtmc, m_instr_usbtmc;
unsigned long m_findList_usbtmc;
unsigned long m_nCount;
ViStatus status;
int m_Timeout = 7000;
char *pStrout; // Write out data buffer
BYTE pStrin[64]; // Read in data buffer
int len;
ULONG nWritten;
ULONG nRead = 0;
char buffer[256];
char instrDescriptor[256];
// Load the NI-VISA library for USBTMC device
hUSBTMCLIB = LoadLibrary ("visa32.dll");
if (!hUSBTMCLIB)
{
MessageBox(NULL, "NIVISA for USBTMC library not found.", "DME1600
multimeter device test", MB_OK);
return;
}
// Link the libraries
signed long (__stdcall *PviOpenDefaultRM_usb)(unsigned long *vi);
signed long (__stdcall *PviFindRsrc_usb)(unsigned long sesn, char *expr,
unsigned long *vi, unsigned long *retCnt, char far desc[]);
signed long (__stdcall *PviOpen_usb)(unsigned long sesn, char *name,
unsigned long mode, unsigned long timeout, unsigned long *vi);
signed long (__stdcall *PviClose_usb)(unsigned long vi);
signed long (__stdcall *PviWrite_usb)(unsigned long vi, unsigned char
*name, unsigned long len, unsigned long *retval);
signed long (__stdcall *PviRead_usb)(unsigned long vi, unsigned char
*name, unsigned long len, unsigned long *retval);
signed long (__stdcall *PviSetAttribute_usb)(unsigned long vi, unsigned
long viAttr, unsigned long attrstat);
Содержание DME1600
Страница 4: ...4 DME1600 This page left blank intentionally...
Страница 5: ...Setup This chapter explains the settings that you need to configure to use the interfaces 1...
Страница 9: ...Message Reference This chapter explains the SCPI com mands 2 Message Reference...
Страница 43: ...Appendix A Error Messages B Sample Programs...
Страница 55: ......