Instructions
Chapter 5 Programming Examples  RIGOL 
RSA3000E Programming Guide  5-23 
#endif 
2.  Edit the DemoForRSA.cpp file to realize various operations of the instrument. 
#include "visa.h" 
#include "DemoForRSA.h" 
DemoForRSA::DemoForRSA() 
{ 
m_strInstrAddr = ""; 
m_strResult = ""; 
m_strCommand = ""; 
} 
bool DemoForRSA::ConnectInstr() 
{ 
ViUInt32 retCount; 
ViStatus status; 
ViSession defaultRM; 
ViString expr = "?*"; 
ViPFindList findList = new unsigned long; 
ViPUInt32 retcnt = new unsigned long; 
string strSrc = ""; 
string strInstr = ""; 
ViChar instrDesc[1000]; 
unsigned long i = 0; 
bool bFindRSA = false; 
memset(instrDesc,0,1000);  
//Turn on the VISA device 
status = viOpenDefaultRM(&defaultRM); 
if (status < VI_SUCCESS) 
{  
cout<<"No VISA equipment!"<<endl; 
return false; 
}  
//Search for resources 
status = viFindRsrc(defaultRM,expr,findList, retcnt, instrDesc); 
for (i = 0;i < (*retcnt);i++) 
{ 
//Acquire the instrument name 
strSrc = instrDesc; 
InstrWrite(strSrc,"*IDN?"); 
usleep(200); 
InstrRead(strSrc,strInstr); 
//If the RSA series is found, then exit 
makeupper(strInstr); 
if (strInstr.find("RSA",0) > 0) 
{ 
bFindRSA = true; 
m_strInstrAddr = strSrc; 










