Instructions

Table Of Contents
Chapter 3 Programming Examples RIGOL
RSA5000 Programming Guide 3-23
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;
break;
}
//Acquire the next device
status = viFindNext(*findList,instrDesc);
}
if (bFindRSA == false)
{
printf("RSA device not found!\n");
return false;
}
return true;
}
bool DemoForRSA::InstrWrite(string strAddr, string strContent) //Write operation
{
ViSession defaultRM,instr;
ViStatus status;
ViUInt32 retCount;
char * SendBuf = NULL;
char * SendAddr = NULL;
bool bWriteOK = false;