For many years, the LabVIEW graphical programming language, with its integrated graphical user interface, has been known as an easy-to-use development tool for building data acquisition and instrument control applications and is especially well suited for quickly prototyping systems. However, in some ways, the simplicity and speed of developing a system with LabVIEW has hidden the fact that LabVIEW is in fact a complete programming language, suitable for handling the biggest and most complex applications that engineers and scientists face today.
LabVIEW has many components that are similar to C and is flexible enough to allow developers to incorporate existing C code or other external code modules in their LabVIEW applications. In addition, LabVIEW provides a streamlined development experience that reduces time to measurement due to various ease of use and built-in measurement features. This paper outlines the similarities in functionality of C and LabVIEW and how to use these standard programming structures and methods. Since this paper discusses the general programming capabilities of LabVIEW, the examples below are not industry-specific.
- Performance: Although performance is mentioned when appropriate, this paper is not designed to be a performance comparison between C and LabVIEW.
- User interface: Many C development tools include user interface editors. However, the ANSI C examples used in this paper do not include a user interface in order to allow for maximum portability. For reference, this paper also includes LabWindows/CVI executables that include ANSI C user interfaces comparable to the LabVIEW user interfaces.
- To view and run the LabVIEW examples: Evaluate LabVIEW by download or request a DVD
- To compile and run the C examples: A C compiler or LabWindows/CVI Evaluation Software
- To run the LabWindows/CVI executables: LabWindows/CVI Run Time Engine or LabWindows/CVI Evaluation Software
2. Example 1 - Basic Structures and Methods
|LabVIEW contains all the basic programming structures and methods found in C, such as loops and arrays. The following application note compares C and LabVIEW examples that generate and sort an array of random numbers. These examples illustrate the concepts of loops, arrays, and data manipulation in C and in LabVIEW.|
Application Note: Can LabVIEW C? - Example 1: Basic Structures and Methods
Example Code: Generating and Sorting Numbers in LabVIEW and C
3. Example 2 - More Complex Programming Concepts
|The following application note illustrates the concepts of data structures, code modularization, file I/O, and data analysis in C and LabVIEW. Specifically, the examples perform tasks commonly used by a teacher’s assistant such as entering enter student information and grades and performing analysis on the data.|
Application Note: Can LabVIEW C? - Example 2: More Complex Programming Concepts
Example Code: Teacher's Assistant in LabVIEW and C
4. Example 3 - Code Reuse in LabVIEW
|The previous two examples demonstrate the similarities between LabVIEW and C, as well as LabVIEW’s capability as a full-featured programming environment. Additionally, LabVIEW graphical programming techniques and built-in features often allow for faster and more efficient ways to solve problems.|
At the same time, there are certain tasks that may be better suited for a traditional programming language such as C, or there may be times when an engineer is restricted to using a specific programming language as his primary development environment but still wants to take advantage of the unique features of LabVIEW.
LabVIEW offers multiple solutions for both scenarios. LabVIEW can call external code contained in dynamic link libraries (DLLs) or shared libraries, and code exposed through ActiveX or .NET interfaces. In addition, LabVIEW code can be reused in other programming languages by building a LabVIEW DLL or shared library, or by using ActiveX. The following application note consists of two parts: the first part focuses on calling a C-built DLL from LabVIEW, and the second part focuses on calling a LabVIEW-built DLL from C.
Application Note: Can LabVIEW C? - Example 3: Using the Right Tools with LabVIEW
Example Code: Calling a C-built DLL in LabVIEW to Generate and Sort an Array of Numbers
Example Code: Calling a LabVIEW-built DLL In C to Acquire, Analyze, and Present Data
5. Advanced Programming Techniques
LabVIEW users must follow much of the same procedures as developers using more traditional languages like C, but at times there are unique tools and practices that simplify the development process. For example, LabVIEW can perform tasks not easily achieved in C, such as object-oriented programming and parallel programming. Focusing on parallel programming, the advent of multicore processors has made many software developers realize the need for a better way to design parallel code. As a graphical programming language based on the core principles of dataflow programming, LabVIEW offers the programmer a simplified approach to parallel programming, one which allows the software developer to immediately take advantage of the processing performance available from the latest generation of multicore processors.
To learn more, read the Multicore Programming Fundamentals white paper series.
This paper discussed a small sampling of the programming capabilities of LabVIEW that are also available in C, including array manipulation and support for DLLs. To learn how to use advanced programming techniques in LabVIEW such as object-oriented programming, and how to implement standard software engineering practices in LabVIEW, visit the Software Engineering resource page.
With the unique approach to programming using block diagrams and dataflow, and ready-to-use features such as measurement analysis libraries, LabVIEW saves development time for engineers and scientists when compared to traditional languages such as C. To evaluate the capabilities of LabVIEW for yourself, try LabVIEW online.
7. What is LabVIEW? Explore the Software Environment
LabVIEW is used for a wide variety of applications and industries, which can make it challenging to answer the question: "What is LabVIEW ?"Get the answer