Instructions

RIGOL Chapter 5 Programming Examples
5-24 RSA3000E Programming Guide
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;
string str;
//Address conversion, convert the string type to char*
SendAddr = const_cast<char*>(strAddr.c_str());
//Address conversion, convert the string type to char*
SendBuf = const_cast<char*>(strContent.c_str());
//Turn on the specified device
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
cout<<"No VISA equipment!"<<endl;
return false;
}
status = viOpen(defaultRM, SendAddr, VI_NULL, VI_NULL, &instr);
//Write command to the device
status = viWrite(instr, (unsigned char *)SendBuf, strlen(SendBuf), &retCount);
//Turn off the device
status = viClose(instr);
status = viClose(defaultRM);
return bWriteOK;
}
bool DemoForRSA::InstrRead(string strAddr, string & pstrResult) //Read operation
{
ViSession defaultRM,instr;
ViStatus status;
ViUInt32 retCount;
char* SendAddr = NULL;
char * result = NULL;