Technical Article

Introduction to National Instruments (NI) LabVIEW Software

June 09, 2021 by Antonio Armenta

Within this first article in the LabVIEW series, learn the basics of how LabVIEW works and some modern applications of the platform.

LabVIEW is a prominent software platform created by automation and instrumentation company National Instruments. The name LabVIEW is an acronym describing what the product was originally designed for (and continues to do nowadays):  Laboratory Virtual Instrument Engineering Workbench. 

 

LabVIEW controls palette

Figure 1. The controls palette in LabVIEW. Image used courtesy of National Instruments

 

Back in the early 1980s, National Instruments was seeking new ways to improve and automate laboratory testing and measurement processes. Back then, scientists relied on rigid hardware tools that did not integrate with each other. Thus, the first version of LabVIEW was released in 1986, essentially providing the first computer-based (virtual) laboratory instruments.

 

History of LabVIEW

The first version of LabVIEW released in 1986 for the Macintosh computer. The concept of Virtual Instruments (VIs) revolutionized the way laboratory, scientific, and engineering measurements were performed at the time. The ability to program and customize measurement tools in a virtual environment opened many possibilities for applications, beyond the traditional laboratory setting, permeating the industrial automation industry.

LabVIEW 2.0 was the first Windows-based application released in 1992 when Windows 3.0 became available and supported the 32-bit application. Then, in 1993, the first multi-platform LabVIEW systems became available. The next iterations continued to improve upon existing features, as well as adding new capabilities as technology evolved. An example of this is LabVIEW 4.0, released in 1997, which was the first release capable of basic communications over the internet.

Another breakthrough version of the application was LabVIEW Real-Time. Released in 1999, Real-Time improved processing speed and made it possible to integrate with control applications. Future releases continued on the trend of improvements and the latest version available today is LabVIEW 2021.

Now that we’ve covered how LabVIEW came to fruition, let’s break down how it works and its typical setup.

 

How Does LabVIEW Work?

LabVIEW Virtual Instrument (VI)

LabVIEW is a graphical programming environment. Each LabVIEW program is called a VI, or Virtual Instrument. The programming language is called “G”. The G language is similar to BASIC and C, in that it is intended for a wide variety of programming tasks and so it is considered general purpose. 

Contrary to C, BASIC, and the majority of programming languages out there, G is entirely graphical. Although not text-based, G still offers most of the standard debugging features from most languages, such as breakpoints and execution step analysis.

Each LabVIEW VI consists of two main components: the front panel and the block diagram. 

 

LabVIEW Front Panel

The front panel is the graphical user interface (GUI), comparable to an HMI. It is the front end of the program. Here, various controls and indicators can be added depending on the application. The icons and graphical representations emulate those of the physical instrument counterparts as much as possible.

 

LabVIEW front panel

Figure 2. The front panel window of a LabVIEW VI. Image used courtesy of National Instruments

 

The inputs to the program are given via different controls. These can be push buttons, potentiometers, knobs, text boxes, and actual physical inputs. The outputs are shown through indicators, such as graphs and LEDs.

 

LabVIEW Block Diagram

The block diagram is, to put it simply, the source code of the VI. All the elements added in the front panel are included in the block diagram as terminals. Each terminal has the possibility to be connected (“wired”) to other terminals in the VI using nodes to form the program. 

Outputs from one terminal can be inputs for another terminal or can supply the data to an indicator. Also, there are numerous functions available that help execute additional operations on the terminal data. Some of these functions are simple, like arithmetic and Boolean logic operations, and others are complex data acquisition and analysis subroutines. 

 

LabVIEW block diagram

Figure 3. Example of a block diagram of a LabVIEW VI. Image used courtesy of National Instruments

 

One of the advantages of the G programming language is its modularity. Each VI created can also function as a sub-VI, or a subroutine that can be called by a main routine. Typically, VIs are constructed in order to handle smaller, simpler tasks. Then, these become sub-VIs of a more complex task, and with more subroutine nesting, highly complex projects can be coded with the basis on many simple VI tasks.

Each of these advantages is why LabVIEW quickly pushed its way into the industrial automation sector, further than simply the medical and pharmaceutical industries. 

 

LabVIEW Industrial Applications

One of the main advantages of the graphical nature of the G programming language is its simplicity to use, relative to other languages. Programmers generally do not need to worry about syntax with G code, which makes LabVIEW a good application to get introduced to automation and scientific measurements in academic settings. The complexity comes as VIs are stacked and nested to form larger programs that are more useful in professional laboratory measurements and industrial automation.

Within a manufacturing environment, LabVIEW is widely used for automated product testing, becoming the standard for the industry. In addition, LabVIEW has been gaining popularity in embedded control applications.

 

Figure 4. A tutorial on instrument automation using LabVIEW. Video used courtesy of LabVIEW

 

When used for automated product testing, LabVIEW can improve the process by maintaining test consistency and increasing test throughput, while reducing test result errors. For product validation, LabVIEW is a useful tool that can simulate different scenarios with different inputs and conditions. This has the advantage of reducing the time it takes in the general testing phase of a new product by reducing the number of real tests needed.

For industrial control and embedded control systems, programmers can use features such as Real-Time Module, field-programmable gate array (FPGA) Module, and I/O hardware integration. Additionally, LabVIEW can communicate with other controllers within a system by using its OPC UA toolkits.

LabVIEW’s features make it useful in an abundance of industries; obviously, there is medical and pharmaceutical, but aerospace, automotive, chemical, oil and gas, and other process industries can also benefit from using LabVIEW. Coming up, we will cover the different types of serial communications and programming used in LabVIEW.