RIGOL DS1000D User Manual

Page 124

Advertising
background image

RIGOL

Programming Guide for DS1000E, DS1000D Series

3-20

8. Add the codes.

Dblclick the Button, enter the programming environment. First of all, declare
“#include <visa.h>” in header file, then add the following codes:

ViSession defaultRM, vi;

char buf [256] = {0};

CString s,strTemp;

char* stringTemp;


ViChar buffer [VI_FIND_BUFLEN];

ViRsrc matches=buffer;

ViUInt32 nmatches;

ViFindList list;


viOpenDefaultRM (&defaultRM);


// acquire USB resource of visa

viFindRsrc(defaultRM, "USB?*", &list,&nmatches, matches);

viOpen (defaultRM,matches,VI_NULL,VI_NULL,&vi);


// send the receiving commands

m_combox.GetLBText(m_combox.GetCurSel(),strTemp);

strTemp = strTemp + "\n";

stringTemp = (char *)(LPCTSTR)strTemp;

viPrintf (vi,stringTemp);

// read the result

viScanf (vi, "%t\n", &buf);


// display the results

UpdateData (TRUE);

m_receive = buf;

UpdateData (FALSE);

viClose (vi);

viClose (defaultRM);


9. Save, build and run the project, you will get an EXE file. When the oscilloscope

has been successfully connected with PC, choose a command such as *IDN?
and click “Send and Read”, the oscilloscope will return the result.

Advertising
This manual is related to the following products: