Specifications

Chapter 4 Programming Demos RIGOL
M300 Programming Guide 4-19
ViChar instrDesc[1000];
CString strSrc = NULL;
CString strInstr = NULL;
CString strCommand[5] = {"SYST:CTYP? 100","SYST:CTYP? 200","SYST:CTYP?
300","SYST:CTYP? 400","SYST:CTYP? 500"};
CString strM300InfoTemp = "";
CString strSlot = "";
unsigned long i = 0;
bool bFindDP = 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);
strAddr =strSrc;
InstrWrite("*IDN?");
::Sleep(200);
InstrRead(&strInstr);
// If the instrument(resource) belongs to the M300 then jump out //from the loop
strInstr.MakeUpper();
if (strInstr.Find("M300") >= 0)
{
bFindDP = true;
strM300InfoTemp = strInstr;
break;
}
//Find next instrument
status = viFindNext(*findList,instrDesc);
}
if (bFindDP == false)
{
MessageBox("Didn't find any M300!");
}
//Dispaly the M300 information
strM300InfoTemp = strInstr;
for(int i=0 ; i < 5 ;i ++ )
{
strSlot.Format("%d",i+1);
InstrWrite( strCommand[i] );
::Sleep(100);
InstrRead(&strInstr);
strM300InfoTemp = strM300InfoTemp + "\r\n" + "SLOT " +strSlot+": "+strInstr.Mid(19);
}