DSA800 series programming guide - Page 232

For DSA815.

Loading ...
Loading ...
Loading ...
RIGOL Chapter 3 Programming Demos
3-10 DSA800 Programming Guide
//If another error occurs, reopen the connection after the connection is closed and
reread from instrument
status = CloseVisaDevice();
Sleep(1000);
status = OpenVisaDevice(m_strInstrAddr);
if (status == 0)
{
status = viRead(m_SessInstr, RecBuf, MAX_REC_SIZE, &retCount);
}
}
}
} while (status < 0);
(*pstrResult).Format("%s",RecBuf);
return bReadOK;
}
7. Add the control message response codes.
1) Connect to the instrument
void CDemoForDSADlg::OnBtConnectInstr() // Connect to the instrument
{
// TODO: Add your control notification handler code here
ViStatus status;
ViSession defaultRM;
ViString expr = "?*";
ViPFindList findList = new unsigned long;
ViPUInt32 retcnt = new unsigned long;
ViChar instrDesc[1000];
CString strSrc = "";
CString strInstr = "";
unsigned long i = 0;
bool bFindDSA = false;
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
// Error Initializing VISA...exiting
MessageBox("No VISA instrument was opened ! ");
return ;
}
memset(instrDesc,0,1000);
// Find resource
status = viFindRsrc(defaultRM,expr,findList, retcnt, instrDesc);
for (i = 0;i < (*retcnt);i++)
{
// Get instrument name
strSrc.Format("%s",instrDesc);
InstrWrite(strSrc,"*IDN?");
::Sleep(200);
InstrRead(strSrc,&strInstr);
// If the instrument(resource) belongs to the DSA series then jump out //from the loop
Loading ...
Loading ...
Loading ...