EasyManuals Logo

Rigol DSA832E Programming Guide

Rigol DSA832E
243 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #221 background imageLoading...
Page #221 background image
Chapter 3 Programming Demos RIGOL
DSA800E Programming Guide 3-7
//Close the system
status = viClose(instr);
status = viClose(defaultRM);
return bWriteOK;
}
2) Encapsulate the read operation of VISA for easier operation.
bool CDemoForDSADlg::InstrRead(CString strAddr, CString *pstrResult) //Read operation
{
ViSession defaultRM,instr;
ViStatus status;
ViUInt32 retCount;
char * SendAddr = NULL;
unsigned char RecBuf[MAX_REC_SIZE];
bool bReadOK = false;
CString str;
// Change the address's data style from CString to char*
SendAddr = strAddr.GetBuffer(strAddr.GetLength());
strcpy(SendAddr,strAddr);
strAddr.ReleaseBuffer();
memset(RecBuf,0,MAX_REC_SIZE);
//Open a VISA resource
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
// Error Initializing VISA...exiting
AfxMessageBox("No VISA resource was opened!");
return false;
}
//Open the instrument
status = viOpen(defaultRM, SendAddr, VI_NULL, VI_NULL, &instr);
//Read from the instrument
status = viRead(instr, RecBuf, MAX_REC_SIZE, &retCount);
//close the system
status = viClose(instr);
status = viClose(defaultRM);
(*pstrResult).Format("%s",RecBuf);
return bReadOK;
}
3) Encapsulate the the read operation with exception handling function of VISA.
ViStatus CDemoForDSADlg::OpenVisaDevice(CString strAddr) //Open a VISA device
{
ViStatus status;
char * SendAddr = NULL;
// Change the address's data style from CString to char*
SendAddr = strAddr.GetBuffer(strAddr.GetLength());
strcpy(SendAddr,strAddr);

Table of Contents

Other manuals for Rigol DSA832E

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Rigol DSA832E and is the answer not in the manual?

Rigol DSA832E Specifications

General IconGeneral
BrandRigol
ModelDSA832E
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals