4. VISA in Programming Languages

There are many programming languages offering the possibility to remotely control Test & Measurement instruments.

In this guide, we focus on:

  • Python in PyCharm
  • MATLAB®
  • C# in Visual Studio
  • LabVIEW™
  • ANSI-C in LabWindows/CVI™

In the following sub-chapters, we discuss advantages and disadvantages of each language. Included ready-to-use example for each of these languages should help you getting started. The screenshots emphasize simple code change in case you change physical connection to your instrument. They also show used layers between the application and VISA.

An installation of VISA is a precondition for all the examples below.

Python in PyCharm

Advantages: State-of-the-art code editor, safe refactoring, GIT integration, excellent debugger, also available for Linux and macOS

Compared to PyVISA, RsInstrument Python package provides many additional features - proper session attribute settings, synchronization functions, error checking, large data transfer in both directions and much more. See the documentation on readthedocs.io

In case you need to install RsInstrument on an offline computer, download our offline installer (Save as) and execute it in your desired python interpretter.

Pycharm Instrument Control Plugin

Check out our new Remote-Control plugin for Pycharm - it helps you writing your remote-control scripts.

You find the documentation here.

MATLAB

Advantages: Simple scripting language, including easy GUI designs.

Disadvantages: No multi-threading, bulky executables.

In MATLAB you change the resource string in the VISA Open() method. The rest of your script is unchanged. See more in the dedicated application note 1MA171

C# in Visual Studio

Advantages: State-of-the-art programming environment, optimized for high performance.

Disadvantages: Requires advanced programming knowledg.

In Visual Studio C# or VB.NET, you use the RsInstrument modul (assembly), which provides same features as the RsInstrument module for Python - proper session attribute settings, synchronization functions, error checking, large data transfer in both directions. You only have to change the resource string in the RsInstrument constructor. The example link below also contains a Visual Basic .NET project.

LabVIEW

Advantages: Ideal for engineers without the need for advanced programming skills, specially developed for instrument remote control applications.

Disadvantages: Lower performance by graphical tasks, difficult to compare versions due to graphical source code.

In LabVIEW, you change the instrument resource string for the LabVIEW function VISA Open. The session stays valid even if your program stops. If you are using instrument drivers, refer to the dedicated application note 1MA228

ANSI-C in LabWindows/CVI

Advantages: ANSI-C environment targeted for instrument remote control.

Disadvantages: Requires advanced programming knowledge.

In C/C++, you change the resource string in the viOpen() function. First, you need to open a resource manager with the function viOpenDefaultRM().

需要更多信息。

如果您有任何疑问或需要了解更多信息,请填写此表格,我们会尽快回复您。

我同意通过以下方式接收罗德与施瓦茨提供的信息:

推广许可

我同意通过电子邮件或邮政信件接收罗德与施瓦茨公司和本网站版权标记指明的罗德与施瓦茨实体或子公司提供的营销或广告信息(例如特价优惠和折扣促销信息)。有关个人数据使用和撤销程序的详情,请参阅隐私声明推广许可

你的申请已提交,我们稍后会联系您。
An error is occurred, please try it again later.