除了基本的.NET项目之外,我还不熟悉其他任何东西,但我目前正在尝试制作一个与T& T一起使用的测试系统。使用SCPI通过GPIB,USB等各种介质进行通信的M仪器。我安装了Keysight IO库,并且已经阅读了其中的VISA.NET帮助文档。
我希望我的程序能够与VISA供应商保持中立(尽可能多),所以决定只通过Ivi.Visa
接口来使用该实现。我正在考虑使用类似于以下伪代码的工具编码通信:
//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();
我刚才注意到,虽然我以前认为我在其他文档中看到的COM示例主要是指较旧的用法,但COM示例仍然被引用(例如Sending SCPI/GPIB commands over USB from C#)。
在Visual Studio Reference Manager中进一步探索我发现不仅有VISA COM类型库,还有仪器特定的IVI程序集(例如:IVI Scope Assembly)和类似的COM类型库(例如:IviScope 3.0类型库)
我对所有这些以及我应该使用或不使用的内容感到有些困惑!
它们的全部内容是什么?我的意思是,它们之间有什么区别,为什么我会使用另一个呢? (也许有一个消息来源简明扼要地解释了某些地方的差异或一般用例?)。
答案 0 :(得分:5)
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:
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.