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: Intelligent code editor, safe refactoring, allows for tracking code changes, excellent debugger, also available for Linux.

Compared to pure PyVisa, RsInstrument provides many extended features - proper session attribute settings, synchronization functions, error checking, large data transfer in both directions.

Disadvantages: Missing compiler means you code is only tested for errors during execution.

In Python 3.x, you use RsInstrument module that internally uses PyVISA. You change the resource string in the RsInstrument class constructor.

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().

Demander des informations

Vous avez des questions ou besoin d'informations supplémentaires ? Remplissez simplement ce formulaire et nous vous recontacterons rapidement.

Je souhaite recevoir des informations de Rohde & Schwarz via

Marketing de permission

Qu'est ce que cela signifie en détail ?

Je reconnais que les entités ROHDE & SCHWARZ GmbH & Co. KG et ROHDE & SCHWARZ ou toute autre société subsidiaire mentionnée au sein de ce site Internet, peuvent me contacter par le moyen de leur choix (email ou courrier) pour des raisons marketing et publicitaires (par exemple pour des informations sur des offres spéciales et des promotions) en relation avec, mais pas uniquement, des produits et des solutions dans les domaines du test et mesure, des communications sécurisées, de la surveillance et test des réseaux, des broadcasts et médias, ainsi que de cybersécurité.

Vos droits

Cette déclaration de consentement peut être révoquée à tout moment par l'envoi d'un courriel portant, dans son objet, la mention "Unsubscribe" (désinscription) à news@rohde-schwarz.com. En outre, chaque courriel envoyé contient un lien vers une fonction de désinscription de publicités ultérieures adressées par courrier électronique. La "Déclaration de confidentialité" expose plus en détail l'utilisation des données personnelles, ainsi que la procédure de révocation de consentement.

Votre demande a bien été envoyée ! Nous vous contacterons dans les plus brefs délais.
An error is occurred, please try it again later.