Instructions

RIGOL Chapter 5 Programming Examples
5-26 RSA3000E Programming Guide
int main()
{
DemoForRSA demo;
char temp[50];
if(!demo.ConnectInstr())
{
cout<<"can not connect the equipment!"<<endl;
return 0;
}
else
{
cout<<"\n connect equipment success!"<<endl;
cout<<" the equipment address is :"<<demo.m_strInstrAddr<<endl;
}
while(1)
{
menudisplay();
//cin>>demo.m_strCommand;
cin.getline(temp,50);
demo.m_strCommand=temp;
if(demo.m_strCommand[0]='r' && demo.m_strCommand[1]='e'
&& demo.m_strCommand[2]='a' && demo.m_strCommand[3]='d')
{
//demo.InstrWrite(demo.m_strInstrAddr,"*IDN?");
//demo.InstrRead(demo.m_strInstrAddr,demo.m_strResult);
cout<<"read result:"<<demo.m_strResult<<endl;
demo.m_strResult="";
}
else if (demo.m_strCommand[0]='w' && demo.m_strCommand[1]='r'
&& demo.m_strCommand[2]='i' && demo.m_strCommand[3]='t' &&
demo.m_strCommand[4]='e')
{
if (demo.m_strInstrAddr="")
{
cout<<"Please connect the instrument\ n";
}
demo.InstrWrite(demo.m_strInstrAddr,demo.m_strCommand.substr(5,40));
usleep(200);
//Read operation
demo.InstrRead(demo.m_strInstrAddr,demo.m_strResult);
}
else if (demo.m_strCommand[0] == 'q' && demo.m_strCommand[1] == 'u'
&& demo.m_strCommand[2] == 'i' && demo.m_strCommand[3] == 't')
{
break;
}
else if(demo.m_strCommand != "")
{