Can LabVIEW C?

Contents

Introduction

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.

Note:

  • 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.

Recommended Software:

 

Basic Structures and Methods

LabVIEW contains all the basic programming structures and methods found in C, such as loops and arrays. Refer to the LabVIEW Help for a complete list of all the structures available in LabVIEW.
 

Code Reuse in LabVIEW

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.

Here are some examples of how to reuse code between LabVIEW and C:

Learn more about using Python, MathWorks® MATLAB® Software, and C/C++ with LabVIEW

 

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.

 

Conclusion

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 with LabVIEW 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, you can download a free trial of LabVIEW