EasyManua.ls Logo

Rigol DG4000 Series - Page 617

Rigol DG4000 Series
646 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...
char * SendAddr = NULL;
bool bWriteOK = false;
CString str;
// Change the address's data style from CString to char*
SendAddr = strAddr.GetBuffer(strAddr.GetLength());
strcpy(SendAddr,strAddr);
strAddr.ReleaseBuffer();
// Change the command's data style from CString to char*
SendBuf = strContent.GetBuffer(strContent.GetLength());
strcpy(SendBuf,strContent);
strContent.ReleaseBuffer();
//open a VISA resource
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
AfxMessageBox("No VISA resource was opened!");
return false;
}
status = viOpen(defaultRM, SendAddr, VI_NULL, VI_NULL, &instr);
//Write command to the instrument
status = viWrite(instr, (unsigned char *)SendBuf, strlen(SendBuf), &retCount);
//Close the system
status = viClose(instr);
status = viClose(defaultRM);
return bWriteOK;
}
2) Encapsulate the read operation of VISA for easier operation.
bool CDemoForDGDlg::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);

Table of Contents

Other manuals for Rigol DG4000 Series

Related product manuals