C# Visual Studio GPIB Commands

后端 未结 5 725
醉梦人生
醉梦人生 2021-01-05 14:10

What commands do you use to talk to a GPIB instrument in C#, visual studio? I need to be able to write commands to the instrument and read the output.

5条回答
  •  时光说笑
    2021-01-05 14:57

    You should create an object with LangInt class first. Then use that object with GPIB methods. Most common and used ones are(assuming you created an object named "dev");

    dev.ibwrt(deviceHandle, "*IDN?", "*IDN?".Length);
    
    dev.ibrd(deviceHandle, out Value, Arraysize);
    

    These two can query the device. Or you can use them consecutively for example setting a generator's frequency and then it's amplitude.

    Important part is before sending SCPI commands; you MUST initialize devices first. To do this use;

    deviceHandle = ibdev(GPIBINDEX, GPIBADDRESS, SECONDARYADDRESS, TIMEOUT, EOTMODE, EOSMODE);
    

    These parameters must declared first within the code. After initialization you can use every GPIB command with that device handles.

    And of course you should add NationalInstruments.NI4882 and LangInt.dll to your project.

提交回复
热议问题