Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which IVI references should I use?

Tags:

c#

visa

gpib

I'm fairly new to anything but basic .NET projects but am currently attempting to make a test system for use with T & M instruments that communicates using SCPI over various media such as GPIB, USB, etc. I have Keysight IO Libraries installed and have been reading the VISA.NET help documentation therein.

I would like my program to be VISA vendor-neutral (as much as possible) so decided to stick to using the implementation only via the Ivi.Visa interfaces. I was thinking of coding communications with an instrument something like the following psuedo-code:

//Access implementation only via IVI interfaces to keep things vendor neutral
using Ivi.Visa;
// Get a session from the manager
var Session = (IGpibSession)GlobalResourceManager.Open(Alias, AccessMode, Timeout);
// Use the formatted IO interface of the session
var io = Session.FormattedIO;

// Some communication operations
// UserCommand is some faux type object
io.PrintfAndFlush("%s", UserCommand.ToString);
if (UserCommand.Query)
    io.Scanf("%s", out UserCommand.Result);

// Doesn't seem to be any Close method on resource manager, session or interface?
Session.DiscardEvents(EventType.AllEnabled);
Session.Dispose();

I just noted however that while I previously thought that COM examples I saw in other documentation mainly referred to older usage, COM examples are still being referred to (eg Sending SCPI/GPIB commands over USB from C#).

Exploring further in the Visual Studio Reference Manager I see that not only is there the VISA COM type library, there are instrument specific IVI assemblies (eg: IVI Scope Assembly) and similar COM type libraries (eg: IviScope 3.0 Type Library).

I'm somewhat bewildered by what all these are for and which ones I'm supposed to use or not use!

What are they all for? I mean, what are the differences between them or why would I use one over the other? (Maybe there is a source that succinctly explains the difference or general use cases somewhere?).

like image 726
Toby Avatar asked Apr 06 '17 11:04

Toby


1 Answers

Here is some background info. In the end, I don't think I can give you up-to-date information that directly answers your question.

You can communicate with your instrument from different levels:

  1. Low-level I/O
  2. VISA
  3. Vendor-provided IVI driver
  4. Class IVI driver

The different levels might depend on the presence of components for a lower level and might allow you to access a lower-level for specific features.

Low-level I/O drivers are either provided by the operating system or the I/O hardware manufacturer. USBTMC and GPIB are examples.

VISA abstracts the I/O drivers, allowing general code to be independent of a particular installation's I/O hardware. It does allow detection of the I/O resources features so you can have branches that perform special operations where needed, such as RS-232 line termination detection or some low-level GPIB feature. The data you send would have to match the instrument's command language, such as SCPI.

An IVI driver is a library that provides instrument domain-specific functions. The driver interacts with the instrument through its command language so you don't need to code that. It might provide passthrough functions so you could read and write using the instrument's command language for features that the library doesn't cover. The IVI driver might use VISA for communications (usually does), and it might require a particular VISA vendor (usually doesn't).

An IVI Class driver is a library that provides common domain-specific functions for one class of instruments such as DMMs and signal generators. This allows your program code to be independent of the instrument vendor. A class driver does require a class-compliant, vendor-provided IVI driver to be installed.

Now, VISA implementations are either COM or shared library (function exports), either of which can be used in Visual Basic (and most other .NET languages). I don't have recent experience with these but a few years ago, between Agilent and NI, Agilent provided COM interfaces and NI provided shared library interfaces.

like image 101
Tom Blodget Avatar answered Nov 07 '22 23:11

Tom Blodget