Specifications
RIGOL 3 Programming Demos
3-4 DS2000 Programming Guide
3-4
C# Programming Demo
The function of the program: read the device information.
1. Build a project. Find visa32.cs in the installation directory of VISA and add it to
the project. After that, visa32.cs is added to the Solution Explorer and the
type visa32 is introduced in.
2. Open the resource manager and then turn on the instrument (you need to set
the descriptor).
Const string
Cdevice_INSTR=@"USB0::0x1AB1::0x04B0::DS2A0000000001::INSTR"
viError=visa32.viOpenDefaultRM(out viDefRm);
viError=visa32.viOpen(viDefRm,cDEVICE_INSTR,0,5000,out viSession);
3. Send the request and read the data.
visa32.viPrintf(viSession,"*IND?\n");
byteReadBuf = new byte[128];
visa32.viRead(viSession,byteReadBuf,128,outretCnt);
The data read (in byte format) needs to be converted to string.
StrIdn="";
For(i=0;i<retCnt;i++);
{
strIdn=strIdn+Convert.ToChar(byteReadBuf[i]);
}
4. After the communication finishes, turn off the instrument and the resource
manager.
visa32.viClose( viSession );
visa32.viClose( viDefRm );