Chapter 4 Programming Examples
RIGOL
DG900 Programming Guide
4-21
5.
Click View
ClassWizard and add the control variables in the Member Variables tab in the pop-up
interface.
Instrument address: CString m_strInstrAddr
Command CString m_strCommand
Returned value CString m_strResult
6.
Encapsulate the read and write operations of VISA.
1)
Encapsulate the write operation of VISA for easier operation.
bool CDG900_Demo_VCDlg::InstrWrite(CString strAddr, CString strContent)
//write function
{
ViSession defaultRM,instr;
ViStatus status;
ViUInt32 retCount;
char * SendBuf = NULL;
char * SendAddr = NULL;
bool bWriteOK = false;
CString str;
//Change the address's data style from CString to char*
SendAddr = strAddr.GetBuffer(strAddr.GetLength());
strcpy(SendAddr,strAddr);
strAddr.ReleaseBuffer();
//Change the command's data style from CString to char*
SendBuf = strContent.GetBuffer(strContent.GetLength());
strcpy(SendBuf,strContent);
strContent.ReleaseBuffer();
//open the VISA instrument
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
AfxMessageBox("No VISA instrument was opened !");
return false;
Summary of Contents for DG952
Page 2: ......
Page 168: ......
Page 181: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 7 ...
Page 185: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 11 ...
Page 187: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 13 ...
Page 199: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 25 ...
Page 200: ......