Instructions

Table Of Contents
Chapter 3 Programming Examples RIGOL
RSA5000 Programming Guide 3-9
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 RSA series then jump out //from the loop
strInstr.MakeUpper();
if (strInstr.Find("RSA") >= 0)
{
bFindRSA = true;
m_strInstrAddr = strSrc;
break;
}
//Find next instrument
status = viFindNext(*findList,instrDesc);
}
if (bFindRSA == false)
{
MessageBox("Didn’t find any RSA!");
}
UpdateData(false);
}
2) Write Operation
void CDemoForRSADlg::OnBtWrite() //Write operation
{
//TODO: Add your control notification handler code here
UpdateData(true);
if (m_strInstrAddr.IsEmpty())
{
MessageBox("Please connect to the instrument first!");
}
InstrWrite(m_strInstrAddr,m_strCommand);
m_strResult.Empty();
UpdateData(false);
}
3) Read Operation
void CDemoForRSADlg::OnBtRead() //Read operation
{