面向各种总线与语言的仪器控制技术
Instrument Control Technologies for Any Bus, Any Language
from:http://zone.ni.com/devzone/cda/tut/p/id/3513Table of Contents
- Overview
- Hardware Bus Technology
- Instrument Control Hardware Solutions
- Application Programming Software Technology
- Instrument Control Software Solutions
- Conclusion
Overview
No matter what your test and measurement application needs are, you need to rely on instrument control technologies that enable you to connect to and control your instruments through any hardware bus and any software programming language. You should be able to individually optimize your choices of hardware bus without having an adverse effect on your choice of software programming language and vice versa.
Therefore, the key to developing reliable, durable, and high-performance instrument control applications is flexible and scalable hardware and software that enable seamless control of any instrument in your application.
This white paper presents the various hardware and software options available to you, helping you choose the most suitable software and hardware for your application.
Hardware Bus Technology
The term instrument control refers to the act of using software on a PC to remotely control an instrument over an instrument control bus. Instruments themselves usually offer one or more bus options through which they can be controlled, and PCs usually also offer multiple bus options for instrument control. If a PC does not natively have the bus that is available on the instrument, it can usually be added as a plug-in board or an external converter. There are many buses that could be used for instrument control. They can be divided into general categories:
- Stand-alone buses that are used to communicate with rack and stack instruments. These include test and measurement specific buses such as GPIB and PC-standard buses such as Serial (RS232), Ethernet, USB, Wireless, and IEEE 1394. Some stand-alone buses can be used as a medium to provide other stand-alone buses, such as in a USB to GPIB converter.
- Modular buses that incorporate the interface bus into the instrument itself. They include PCI, PCI Express, VXI, and PXI. These buses can also be used as a medium to add a stand-alone bus into a PC that does not have one, such as in a PCI-GPIB controller board.
Stand-Alone Buses
GPIB
The General Purpose Interface Bus (GPIB) is one of the most common I/O interfaces available in stand-alone instruments. GPIB was designed specifically for test and measurement and instrument control applications. Originally designed by Hewlett Packard (predecessor to Agilent Technologies) in the 1960s as HP-IB, the GPIB was standardized in 1975 as IEEE Standard 488-1975. The original standard defined the electrical, mechanical, and functional specifications of the bus while also defining its basic software communication rules. ANSI/IEEE Standard 488.2-1987 strengthened the original standard by defining precisely how controllers and instruments communicate through GPIB (the original standard was renamed IEEE 488.1-1975). In 2003, an update of the original specification, IEEE 488.1-2003 was released, which defined a high-speed data transfer mode. GPIB is a digital, 8-bit parallel communications interface with data transfer rates of up to 8 Mb/s. The bus provides one system controller for up to 14 instruments, and cabling is limited to less than 20 m. Users can overcome both of these limitations by using GPIB expanders and extenders. GPIB cables and connectors are versatile and industrially graded for use in any environment.
Not being a PC industry bus, it is rarely available natively on a PC. Instead, users usually use a plug-in board such as a PCI-GPIB or external converter such as a GPIB-USB to add GPIB instrument control functionality to their PCs.
Serial (RS232)
The RS232 is a specification for serial communication and is the most common flavor of the “serial” bus as referred to traditionally. RS232 is popular in analytical and scientific instruments and is commonly used to control modems and printers. Unlike GPIB, with the RS232 interface you can connect and control only one device at a time. RS232 is also a relatively slow interface, with typical data rates of less than 20 kb/s (although there are products that can achieve higher data throughputs).
RS232 is a common PC bus and is found on most older desktop and laptop PCs. You can also purchase serial products that provide one or more additional ports through either a plug-in PCI card or external USB converter for example.
USB
The Universal Serial Bus (USB) was designed primarily to connect PC peripheral devices, such as keyboards, mice, scanners, and disk drives to PCs. Over the last several years, the number of devices that support USB connectivity has increased dramatically. USB is a plug and play technology allowing the USB host to automatically detect when a new device has been added, query the device for its identification, and configure the device drivers appropriately. Up to 127 devices can run concurrently on one port connected through hubs. USB is defined by a standards body called the USB Implementers Forum (USB-IF). The original USB 1.1 (USB 1.0 with minor bug fixes) specification defined two data transfer modes and speeds: Low-speed with throughputs reaching a maximum of 1.5 Mb/s (200 kB/s), and full-speed with maximum data throughput of 12 Mb/s (1.5 MB/s). The latest USB specification, USB 2.0 is fully backward compatible with both low-speed and full-speed devices but defines a new Hi-Speed mode capable of data transfer rates of up to 480 Mb/s (60 MB/s).
Although USB was originally designed as a PC peripheral bus, it’s speed, wide availability, and ease-of-use make it attractive for use in instrument control applications. At the same time, there are some drawbacks in its use for instrument control. First, USB cables are not industrial graded, which potentially allows data loss in noisy environments. Moreover, there is no latching mechanism for USB cables – the cables can be pulled out of the PC or instrument relatively easily. Also, the maximum cable length in USB systems is 30 m, including the use of inline repeaters.
Ethernet
Ethernet is a mature technology that is widely used for measurement systems in other capacities, including general networking and remote data storage. With more than 100 million Ethernet capable computers worldwide, Ethernet also offers an attractive option for instrument control. Ethernet is defined as IEEE Standard 802.3 and offers network configurations that support theoretical data transfer rates of 10 Mbs (10BASE-T), 100 Mb/s (100BASE-TX), and 1 Gb/s (1000BASE-T). Currently the most commonly available networks are networks are 100BASE-TX. Instrument control applications over Ethernet can take advantage of the unique characteristics of the bus, including remote control of instruments, simplified instrument sharing, and easy publication of data results. Moreover, users gain the advantage of existing, extensive Ethernet networks in their companies and laboratories. However, this advantage may pose a problem in some companies because it forces the involvement of network administrators in traditional engineering applications.
Additional drawbacks of Ethernet as an instrument control bus are actual transfer rates, determinism, and security. Although Ethernet networks can achieve theoretical transfer rate of 1 Gb/s, these rates are rarely realized on a true network because of other network traffic overhead and inefficient data transfer. Moreover, because of the uncertainty of transfer rates, determinism is not assured in communicating across Ethernet. Finally, for sensitive data users must take additional security measures to ensure data integrity and privacy.
Wireless
Wireless technology is fast emerging on the market as a convenient way to connect devices together. The most widely available technology that is used commercially is wireless Ethernet (IEEE 802.11 commonly referred to as Wi-Fi or Wireless Fidelity). IEEE 802.11 includes several sub standards (802.11a, 802.11b, and 802.11g), which define the frequency band of operation, the operating distance, and the speed of transmission for the wireless connection. 802.11b & g are compatible with each other but not compatible with 802.11a. The maximum data transfer rates are 54 Mb/s for 802.11g & a. Wireless technology in general could be applied to instrument control because while it suffers from some of the same security issues as Ethernet (with additional issues related to the wireless nature of the connection), it does offer the convenience of remote control without necessity for cabling.
Other wireless technologies that are available on the market or are in development include Bluetooth, ZigBee, and Wireless USB. While it is beyond the scope of this paper to discuss these in detail, they could offer an alternative way to wirelessly connect to instruments.
IEEE 1394 (FireWire)
FireWire, or IEEE 1394, is a high-performance serial bus originally developed by Apple computer in the early 1990s. The baseline standard handles throughput rates of up to 400 Mb/s, and the b revision of the specification increases this transfer rate to 3.2 Gb/s. While devices must be within 4.5 m of the bus socket to conform to the specification, up to 16 devices can be daisy chained together for a maximum run of 72 m. IEEE 1394 however, is less than ideal for test and measurement applications. For example, the 1394 cables are not industrial graded, the isochronous mode allows this bus to guarantee bandwidth but does not guarantee that no data will be lost, and application testing shows 1394 data transfers to be much lower than their theoretical values. In addition, FireWire is less than ideal for instrument control because unlike USB and Ethernet, it is not widely available on PCs and hardly any instruments support it.
Modular Buses
PCI
The PCI bus was first introduced in the early 1990s. One of its goals was to have a unifying effect on the multitude of I/O buses available on PCs at that time, such as VESA local bus, EISA, ISA, and Micro Channel. PCI was first implemented as a chip-to-chip interconnect and as a replacement for the fragmented ISA bus. The PCI bus brought a number of advantages over previous bus implementations. Among the most important were processor independence, buffered isolation, bus mastering, and true plug-and-play operation. Buffered isolation essentially isolates, both electrically and by clock domains, the CPU local bus from the PCI bus. With bus mastering, PCI devices can gain access to the PCI bus through an arbitration process and master the bus transaction directly, as opposed to waiting for the host CPU to service the device, which results in a reduction of overall latency on servicing I/O transactions. Finally, plug-and-play operation, which permits devices to be automatically detected and configured, eliminated the manual setting of switches and jumpers for base address and DMA interrupts that frustrated users of ISA-based boards. The PCI bus is typically not used directly for instrument control but as a peripheral bus to connect GPIB or serial devices for instrument control. Also, because of its high bandwidth, PCI is also used as a carrier bus for modular instruments where the I/O bus is built into the measurement device.
PXI
PXI (PCI eXtensions for Instrumentation) is a rugged PC-based platform for measurement and automation systems. PXI combines PCI electrical-bus features with the rugged, modular, Eurocard mechanical-packaging of CompactPCI, then adds specialized synchronization buses and key software features. This makes it both a high-performance and low-cost deployment platform for measurement and automation systems. These systems serve applications such as manufacturing test, military and aerospace, machine monitoring, automotive, and industrial test. Developed in 1997 and launched in 1998, PXI was introduced as an open industry standard to meet the increasing demands of complex instrumentation systems. Today, PXI is governed by the PXI Systems Alliance (PXISA), a group of more than 65 companies chartered to promote the PXI standard, ensure interoperability, and maintain the PXI specification. PXI is heavily used as a platform for modular instrumentation providing an attractive alternative to traditional stand-alone instrumentation through compact, high-performance measurement hardware devices with integrated timing and synchronization resources.
PCI Express
As PC applications become more bandwidth intensive, the PCI bus is reaching its physical limits in many situations. As a result, the PCI-SIG, the standards body that defines PCI, has introduced PCI Express. Its main goals are to provide a scalable, low-cost interface that serves many differing markets and provide compatibility at the software level with existing PCI card drivers and software. The PCI Express architecture is specified in layers. Compatibility with the PCI addressing model is maintained to ensure that all existing applications and drivers operate unchanged. The PCI Express configuration uses standard mechanisms defined in the PCI plug-and-play specification. The software layers will generate read and write requests that are transported by the transaction layer to the I/O devices using a packet-based, split-transaction protocol. The link layer adds sequence numbers and CRC to these packets to create a highly reliable data transfer mechanism. The basic physical layer consists of a dual simplex channel that is implemented as a transmit pair and a receive pair. The initial speed of 2.5 Gb/s in each direction provides a 200 MB/s communications channel in each direction, which is close to four times the classic PCI data rate. As with PCI, PCI Express is typically not used directly for instrument control but as a peripheral bus to connect GPIB devices to PCs for instrument control. But because of its tremendous speed, PCI Express can be used as a carrier bus for modular instruments.
VXI
The VME eXtensions for Instrumentation (VXIbus) was the first attempt at a multivendor industry standard specific to instrumentation. As the name implies, VXI builds on the VME bus and is based on the VME backplane. It was defined in 1987 and later standardized as IEEE Standard 1155. Its goals included increased interchangeability, decreased size, increased system throughput, and lower cost. VXI retained the GPIB communication methodology and more than 80 percent of VXI instruments used message-based communication. The VXI bus did have major accomplishments in achieving some of its goals. Although still bulky, VXI systems did achieve a reduction in physical size. VXI also achieved better interoperability between vendors and defined an electrical specification that provides more precise timing and synchronization. The VXIbus also had some shortcomings including the lack of a software standard, the inability to achieve significant increased system throughput, and the inability to achieve its goal of reduced system cost because VXI did not leverage standard commercial PC technologies.
Instrument Control Hardware Solutions
Regardless of your instrument control bus choice, you can rely on instrument control hardware solutions from National Instruments to meet your needs. There are products to communicate to certain instruments directly via GPIB or RS232, as well as products that allow the connection to those instruments via bus converters. There are also software solutions that allow for connecting directly to instruments via PC buses. Finally, modular buses provide a way to combine the communication bus and the measurement hardware into one device.
Stand-Alone Buses
You can connect to GPIB-based instruments primarily via plug-in cards for your PC. These include the NI PCI-GPIB, the NI PCIe-GPIB, and the NI PCMCIA-GPIB to name a few. These products have available driver software for Windows, Linux, and Mac OS X.
You can also connect to Serial-based instruments via the serial ports available on your PC. However, since most of today’s PCs no longer include serial ports, you can purchase NI plug-in cards, including the NI PCI-843x family.
To connect to Ethernet or USB instruments directly via those buses, you can use the ports that are readily available on your PC and NI-VISA software from NI. However, due to the slow adoption of these new bus technologies for instrument control, you can use bus converters as a viable solution for instrument control. This allows you to take advantage of the latest bus technology while also preserving your investment in your existing GPIB and/or serial instruments. The bus converters are software compatible with the plug-in versions of the NI GPIB and/or serial hardware also allowing you to maintain your investment in software.
National Instruments offers a variety of GPIB external controllers. The compact NI GPIB-USB-HS is based on USB 2.0 Hi-Speed technology and transforms any computer with a USB port into a full-function, plug and play, IEEE-488.2 controller that can control up to 14 programmable GPIB instruments. The small size and light weight of the GPIB-USB-HS make it ideal for portable applications using a laptop computer or benchtop applications where the computer has no available internal I/O slots. With the NI GPIB-ENET/100, our Ethernet-to-GPIB controller, you can control and share instruments located anywhere in the world via a TCP/IP network. If the NI GPIB-ENET/100 is combined with an off the shelf wireless access point or router, you can use it to wirelessly control your GPIB instruments.
National Instruments also offers a variety of serial external controllers that can be used to control existing RS232 serial instruments via newer PC buses. The NI ENET-232 product offers 2- and 4-port versions that you can use to control and share analytical or laboratory serial instrument located anywhere on your network. The NI USB-232 product is available as a 1-port dongle or a 2- or 4-port box that you can use to control serial instruments via USB.
Modular Buses
National Instruments has available modular instruments for both PCI and PXI. These instruments combine the measurement capabilities of a stand-alone instrument with the benefits of a high-performance bus. These compact, high-performance measurement hardware devices integrate timing and synchronization resources and include digitizers, function and arbitrary waveform generators, high-speed digital I/O devices, digital multimeters, and RF measurement hardware.
In addition, you can learn about the products available for the PXI platform, the open, multivendor standard for measurement and automation that delivers more than 10 times the performance of older measurement and automation architectures. You can combine the PXI platform with modular instruments to create complete measurement and automation solutions.
Application Programming Software Technology
As all of these technologies converge in the test and measurement arena, multi-interface and multivendor systems become increasingly prevalent. To take advantage of the latest technology, you need to have in place a software architecture that can handle those systems with minimal effort and with maximum software reuse. The best approach is to use a layered architecture that takes care of the intricacies of the various hardware buses and allows you to easily integrate your measurement hardware into the rest of your system. The ideal software architecture (shown in Figure 1 below) includes powerful and flexible application software that uses instrument drivers or direct I/O capabilities to configure and control instruments using I/O software and utilities.
![](https://i-blog.csdnimg.cn/blog_migrate/f7584165b0aab296253bc029602a5574.gif)
[+] Enlarge Image
Figure 1. Software Architecture for Instrument Control Systems
Application Software
When evaluating an application development environment (ADE) for your instrument control system, it is important to choose a software tool with the right built-in instrument control functionality, including both instrument drivers and direct I/O capability. Choosing the right ADE early on helps ensure your projects’ success by giving you the required tools to develop higher quality products faster.
A key to ensure your projects’ success is a software package with built-in out-of-the box instrument control capabilities. You need software that has a choice of instrument I/O libraries and utilities that allow you to simplify communication with your instruments regardless of the instrument bus in use. Without a built-in I/O library, you are left with no choice but to perform very low level programming of the OS and the I/O bus. In addition, the ADE you use should provide a complete set of functionality. Although you could find some software packages or executables that can perform basic I/O, a complete ADE provides considerable advantages including customization, application integration, system connectivity, and robust analysis and presentation capabilities. Once you have acquired the data from your instrument, all of these features help you analyze and present your acquired data and integrate the results into the rest of your measurement system.
More detail is provided later about the right I/O libraries and utilities to use, however, these actually integrate into your ADE through either instrument drivers or direct I/O capability.
Instrument Drivers
Once you have chosen the right ADE, you can control your instruments either by using an instrument driver or through direct I/O commands. Generally, using an instrument driver if one is available is the preferred approach because it is more efficient and has some time-saving benefits. An instrument driver is a library that contains high-level functions that allow you to control a specific instrument or family of instruments. Instrument drivers are the key to rapid development of test and measurement applications. By providing high-level and modular libraries for easy programming, they eliminate the need for you to learn complex, low-level programming protocols that may be specific to one instrument. An instrument driver is a set of software routines that correspond to a programmatic operation such as configuring, reading from, writing to, and triggering the instrument. In addition, since instrument drivers typically have a common structure, and a common API for instruments in the same class, once you have used one instrument driver, it is easy to use another. National Instruments provides instrument drivers for a wide variety of instruments; these instrument drivers are written in NI LabVIEW and/or LabWindows™/CVI and use the Virtual Instrumentation Software Architecture (VISA) API for instrument control. All of these instrument drivers are available from the instrument driver network (IDNet) at ni.com/idnet
There are two different types of instrument drivers to meet the differing requirements of instrument control and test applications: Plug&Play drivers and IVI drivers. Plug&Play instrument drivers simplify controlling and communicating with your instrument through a standard and simple programming model for all drivers. Plug&Play Instrument Drivers provide native source code for LabVIEW and LabWindows/CVI. Interchangeable virtual instruments (IVI) drivers are more sophisticated instrument drivers that feature increased performance and flexibility for more complex test applications that require interchangeability, state-caching, or simulation of instruments. You should use whichever driver type is available for your instrument; however, you only need to use IVI drivers if your application requires their advanced features. This is typically true only for a small subset of high-end applications.
![](https://i-blog.csdnimg.cn/blog_migrate/064a4d2dc7203648597df67c567846d4.gif)
Figure 2 . Instrument Driver Choices: IVI, Plug&Play , and Direct I/O
LabVIEW Plug&Play Drivers
A LabVIEW Plug&Play instrument driver is a set of VIs (virtual instruments) used to control and communicate with a programmable instrument. Each VI corresponds to a programmatic operation such as configuring, reading from, writing to, or triggering the instrument. LabVIEW Plug&Play instrument drivers comply with requirements and recommendations for programming style, error handling, front panels, block diagrams, icons, and online help. Because LabVIEW Plug&Play drivers maintain a common architecture and interface, you can quickly and easily connect to and communicate with your instruments with very little code development. Moreover, with the standard programming model of LabVIEW Plug&Play instrument drivers, you can easily add instruments to your test system without worrying about learning new communication protocols or spending time understanding new programming paradigms.
LabWindows/CVI Plug&Play Drivers
A LabWindows/CVI Plug&Play instrument driver is a set of ANSI C software routines used to control and communicate with a programmable instrument. Each routine corresponds to a programmatic operation such as configuring, reading from, writing to, or triggering the instrument. LabWindows/CVI Plug&Play instrument drivers comply with requirements and recommendations for programming style, error handling, function panels, function trees, and help files. Because LabWindows/CVI Plug&Play drivers maintain a common architecture and interface, you also can quickly and easily connect to and communicate with your instruments with very little code development, and easily add instruments to your test system without worrying about learning new communication protocols or spending time understanding new programming paradigms.
Interchangeable Virtual Instruments (IVI) Drivers
IVI drivers are more sophisticated instrument drivers that feature increased performance and flexibility for more complex test applications that require interchangeability, state-caching, or simulation of instruments. IVI drivers are based on industry standards developed by the IVI Foundation. The IVI Foundation was formed to create an instrument driver standard that builds on the VXIplug&play standards but also provides advanced features such as instrument interchangeability, simulation, state-caching, and multithread safety. The IVI Foundation defines two architectures for IVI drivers, one based on ANSI-C and the other on Microsoft Component Object Model (COM) technology. Both architectures are designed to coexist and are not mutually exclusive. IVI-C drivers and IVI-COM drivers can be used in the same application. Although the technologies underlying IVI-C and IVI-COM are different, the implementation technology by itself should not be your primary concern. Instead, you should focus on two key issues: (1) the longevity of the architecture on which the instrument driver is based; and (2) the usability of instrument drivers in your ADE.
Architectural Longevity: The issue of architectural longevity is particularly important to users of IVI drivers. Interchangeability is one of the most beneficial features of IVI, and a primary reason for achieving interchangeability is to make it easier to replace instruments in systems that must last 10 to 20 years. Having a common API for instrument drivers is not sufficient if the architecture on which those instrument drivers are based changes every few years. It is for this reason that the IVI-C architecture is preferred. ANSI-C is a long established standard that is available on all platforms, and is expected to remain so. Conversely, COM is not freely available on all platforms and has already been superseded by .NET.
Usability: One of the key motivations behind IVI-COM drivers is the desire to develop one driver that works automatically in all development environments. Unfortunately, this comes at the expense of usability. IVI-COM drivers present an interface style that is optimal only in Microsoft Visual Basic 6.0, which was superseded by Microsoft Visual Basic .NET. Ideally, instrument drivers should present an optimal interface for each ADE in which they are used. For example, instrument drivers should be presented as a set of LabVIEW VIs for use in LabVIEW, a set of C++ classes for use in Microsoft Visual C++, and a set of .NET classes for use in Microsoft Visual Basic.NET and Visual C#.
Although IVI-C drivers are the best choice to build an interchangeable test system that can stand the test of time, if all that is available for your instrument is an IVI-COM or VXIplug&play instrument driver, then you should use it. Your goal is to be able to easily communicate with your instruments and not to be tied to one driver technology or another.
Direct I/O
If you cannot find an instrument driver for your particular instrument or if you do not need to use an instrument driver, interactive tools are available to facilitate direct I/O control and communication as well.
Some reasons why you would not use an instrument driver include:
- You only need to send a few commands to your instrument
- An instrument driver does not exist
- You do not need to distribute a set of instrument commands to other developers
Regardless of whether by choice or because an instrument driver is not available; you should take advantage of the interactive, direct I/O capabilities built into the ADE. NI software offers the Instrument I/O Assistant, built-in VISA and bus-specific interfaces, and several debugging tools within Measurement and Automation Explorer (discussed later in this document) including NI Spy, Interface Bus Interactive Control (IBIC – for GPIB), and VISA Interactive Control (VISAIC).
Instrument I/O Assistant
Instrument I/O Assistant provides a user interface to interactively write commands to a device, read data that the device returns, and specify how to parse the response into a format relevant to your application. It is fully integrated into all NI ADEs. Instrument I/O Assistant simplifies the challenge of writing instrument control applications by automatically generating code from your configurations in your environment. Instrument I/O Assistant also helps you quickly parse complex responses from an instrument for use in native-code instrument drivers. Because string parsing can be complex, using the assistant’s interactive window to parse complicated responses can save you time in creating your instrument application.
[+] Enlarge Image
Figure 3. Instrument I/O Assistant Interactive Dialog
I/O Software and Utilities
Regardless of whether you use direct I/O or instrument drivers, internally either of these technologies uses I/O software to perform the actual communication with the instruments. In addition there are also many utilities available to help you in your development, to configure your hardware and debug your applications.
VISA I/O Software
In the early 1990s many nonstandard commercial implementations of I/O software for GPIB, serial, and VXI existed. While many of those were of extremely high quality and served the purpose for their users, there was a need for common standard I/O software that could be used across multiple buses. As a step toward that goal, the VXIplug&play Systems Alliance developed one specification for I/O software – Virtual Instrument Software Architecture (VISA). VISA provides a common foundation for the development, delivery, and interoperability of high-level multi-vendor system software components, such as instrument drivers, soft front panels, and application software. Although the VXIplug&play Systems Alliance defined the VISA specification, it was up to individual vendors to provide different implementations of VISA. Because VISA defines one application programming interface (API) for instrument communication, you can preserve your software investment when you migrate to new interface buses or mixed I/O systems.
Today VISA defines an I/O interface for communicating with instruments via GPIB, serial, USB, Ethernet, PXI, and VXI. Users can create applications that communicate with instruments through any of those buses using essentially the same API. In addition, when using an instrument driver for a GPIB instrument for example, if that driver was written using VISA and the instrument is later released with an Ethernet interface in addition to the GPIB interface, then using that Ethernet interface is as easy as changing the initialization string.
Bus-Specific I/O Software
In addition to VISA there are also several bus-specific I/O software implementations that can be used. These include software for GPIB interfaces that is compliant with the APIs defined by IEEE Standards 488.1 and 488.2. Many vendors provide GPIB I/O driver software, NI driver and the NI-488 API has become the de facto industry standard by providing a stable API that has not changed since the early 1980s and is supported on a multitude of operating systems and work with a wide variety of bus interfaces.
I/O Software Utilities
Regardless of the I/O software used, I/O software utilities can be used to simplify the application development process. These include utilities for configuring and troubleshooting the hardware, interactive control and communication, API tracking or spying, and bus analysis. All of these utilities can help simplify your application development tasks and can reduce your development time considerably.
Instrument Control Software Solutions
Once you have chosen your hardware, NI has a wide variety of software solutions that fit into the categories defined above. Lets look at a sampling of all of them.
Application Software
National Instruments provides several development environments for creating instrument control applications.
LabVIEW
LabVIEW is a complete graphical development environment. It is a highly interactive and open environment for the rapid prototyping and incremental development of applications, from measurement and automation, to real-time embedded, to hardware design. LabVIEW delivers all of the flexible benefits of traditional development environments in addition to revolutionary, rapid development capabilities through graphical programming. With LabVIEW, you can design custom virtual instruments by creating a graphical user interface through which you:
- Operate the instrumentation program
- Control selected hardware
- Analyze acquired data
- Display results
You can customize front panels with knobs, buttons, dials, and graphs to emulate control panels of traditional instruments, create custom test panels, or visually represent the control and operation of processes. The similarity between standard flow charts and LabVIEW graphical programming shortens the learning curve associated with traditional, text-based languages.
You determine the behavior of the virtual instruments by connecting icons together to create block diagrams, which are natural design notations for scientists and engineers. With graphical programming, you can develop systems more rapidly than with conventional programming languages, while retaining the power and flexibility needed to create a variety of applications.
LabWindows/CVI
LabWindows/CVI is also a complete development environment, but one based on ANSI C as opposed to graphical development. In the same way that LabVIEW offers the flexibility delivered by a measurement and automation-specific environment, so does LabWindows/CVI. LabWindows/CVI streamlines ANSI C development with hardware configuration assistants, comprehensive debugging tools, and interactive execution to run functions at design time. Built-in measurement libraries enable rapid development of complex instrument applications including direct bus support, analysis functions, and user interface controls.
Microsoft Visual Studio
Microsoft Visual Studio, including Visual C# .NET, Visual Basic .NET, Visual Basic 6.0, and Visual C++ is also a complete development environment. However, unlike LabVIEW and LabWindows/CVI, the Microsoft Visual Studio environment is a general-purpose tool not designed or optimized for measurement and automation application development. Therefore, it does not contain built-in tools for measurement and automation-specific tasks including instrument control, measurement data analysis or measurement data presentation. This is where NI Measurement Studio add-in tools help you. Measurement Studio takes the general-purpose Visual Studio environment and integrates native instrument control interfaces, advanced analysis routines, and native user interface controls specifically designed to display measurement data.
SignalExpress
SignalExpress is interactive software designed to meet the needs of design and test engineers who need to quickly acquire and analyze electronic signals. SignalExpress simplifies your exploratory and automated measurement tasks by offering: a drag-and-drop, nonprogramming environment; rapid measurement configuration; integration of simulation data; and extended functionality through LabVIEW. In addition SignalExpress provides direct instrument control and connectivity to hundreds of instruments through IVI-C instrument drivers.
Instrument Drivers
National Instruments provides drivers for more than 4,000 instrument models through the instrument driver network (IDNet). These drivers are a combination of LabVIEW plug&play , LabWindows/CVI plug&play , and IVI drivers for instruments such as oscilloscopes, digital multimeters (DMMs), RF signal generators, and switches from vendors such as NI, Agilent Technologies, Tektronix, Keithley Instruments, and others. You can browse the library and download drivers at ni.com/idnet
Direct I/O
National Instruments provides direct I/O capabilities through the Instrument I/O Assistant described above. The Instrument I/O Assistant allows communication with and control of virtually any instrument as long as it accepts ASCII text commands and returns text responses. It also allows for easy parsing of responses and is built into all NI ADEs including LabVIEW, LabWindows/CVI, and Measurement Studio for Microsoft Visual Studio.
I/O Software and Utilities
NI provides two main I/O software packages along with the appropriate application development and debugging.
NI-VISA
NI-VISA is the NI implementation of the VISA standard. It supports communication with instruments via GPIB, serial, Ethernet (VXI-11 and sockets), USB (USBTMC-USB488 and sockets), PXI, and VXI. NI-VISA ships with NI software ADEs as well as hardware such as GPIB controllers that benefits from its functionality.
NI-488.2
NI-488.2 is the NI driver for GPIB software communication. It is the de facto industry standard API that is emulated by many other companies. It provides the basic IEEE 488.1 style commands such as ibwrt , ibrd , etc. as well as the less used IEEE 488.2 style commands. It is intended for use with all NI GPIB controllers including plug-ins such as the NI PCI-GPIB or NI PCIe-GPIB and external controllers such as the NI GPIB-USB-HS and the GPIB-ENET/100.
Interactive Control
Both NI-VISA and NI-488.2 come with interactive control utilities that allow you to interactively communicate with your instruments to verify that you set up your hardware correctly. These provide a very basic interface and are mostly useful for initial setup and verification. For more advanced interactive instrument communication tasks, you should use the Instrument I/O Assistant.
NI Spy
NI Spy is a utility that is provided with NI I/O software. As the name implies, it “spies” on I/O software calls providing a detailed command by command report of the calls that occurred either through NI-488.2 or NI-VISA or through other NI drivers such as drivers for our modular instruments as well as IVI class drivers.
Getting Started and Troubleshooting
NI-488.2 ships with a getting started wizard and a troubleshooting wizard. These help in GPIB controller installation and setup and help you troubleshoot any problem if they do arise.
GPIB Analyzer
NI also has a GPIB analyzer utility that ships with NI-488.2 and can be used with a GPIB controller with analyzer functionality (e.g., PCI-GPIB+) to check on the electrical state of all 8 GPIB data lines and all 8 GPIB bus management lines. It is a very useful tool for more complex debugging applications.
Conclusion
While there is a multitude of bus and software technologies available for you to choose for your instrument control application, you should have the freedom to choose the best bus based on your specific application needs. Your software choice should not be constrained by your hardware choice and vice versa.
While new hardware buses are emerging as viable options for instrument control, other more mature reliable buses are also still available on the market. The key to taking advantage of the new buses while maintaining your investment in your existing technologies is to rely on a layered software architecture that provides robust application development environments, instrument drivers, direct I/O capabilities, and powerful, multibus I/O software and utilities. NI delivers the most flexible instrument control software and hardware tools including optimized industry-standard ADEs, the broadest selection of instrument control and measurement hardware, and a comprehensive library of instrument drivers.
Related Links:
The Future of New Bus Technologies for Instrument Control
Long-Term Instrument Control and Connectivity Solutions
IVI-C Driver Technology Enables System Longevity and Platform Portability