EasyManua.ls Logo

Rigol DSA832E - Page 240

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
Loading...
RIGOL Chapter 3 Programming Demos
3-26 DSA800E Programming Guide
string str;
//Address conversion, convert the strig type to char*
SendAddr = const_cast<char*>(strAddr.c_str());
//Address conversion, convert the strig type to char*
SendBuf = const_cast<char*>(strContent.c_str());
//Turn on the actual 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 into the device
status = viWrite(instr, (unsigned char *)SendBuf, strlen(SendBuf), &retCount);
//Turn off the device
status = viClose(instr);
status = viClose(defaultRM);
return bWriteOK;
}
bool DemoForDSA::InstrRead(string strAddr, string & pstrResult) //Instrument reads
{
ViSession defaultRM,instr;
ViStatus status;
ViUInt32 retCount;
char* SendAddr = NULL;
char * result = NULL;
bool bReadOK = false;
unsigned char RecBuf[MAX_REC_SIZE];
string str;
memset(RecBuf,0,MAX_REC_SIZE);
result=char*)malloc(MAX_REC_SIZE*sizeof(char));
memset(result,0,MAX_REC_SIZE);
//Address conversion, convert the strig type to char*
SendAddr=const_cast<char*>(strAddr.c_str());
//Turn on the VISA device
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
// Error Initializing VISA...exiting
cout<<"No VISA equipment!"<<endl;
return false;
}
//Turn on the actual device
status = viOpen(defaultRM, SendAddr, VI_NULL, VI_NULL, &instr);
//Read the device

Table of Contents

Other manuals for Rigol DSA832E

Related product manuals