LabVIEW code/programs
Below are some LabVIEW programs and VIs we have written and have made available to the LabVIEW community. The Presentation Timer is shareware, but all of the rest are free with the sole condition being that the attribution to their original author be left intact in the VI documentation. Although it is not required, if you do download any of these programs, we would appreciate hearing from you. Let us know (using the Contact form at the upper right of our website) how well they work for you, and if you have any suggestions for improvements or observations of bugs that need fixing.
MICAS-X
MICAS-X is a new product by Original Code Consulting. It is a highly-customizable program for acquiring data from and controlling scientific instruments.
MICAS-X provides a broad range of software infrastructure features many atmospheric and scientific instruments need, while providing a framework for integrating the customized software required for a specific application.
Visit the MICAS-X page for more information.
Instrument Communication Module
The Instrument Communication Module is a toolkit currently under development as an open source project which is intended to replace OSDS as a simpler, more powerful, and more functional way to add configurable instrument communication to a LabVIEW project. It is currently being developed in LabVIEW 2018, and is based on LVOOP design principles. Using ICM, one can easily integrate a wide range of instruments into a LabVIEW program in such a way that the end user can easily configure which instruments are being used, which channels are included, what the channels are named, and what scaling is applied to each channel. ICM is intended for "slow" data, such as housekeeping or instrument health data, typically acquired and controlled at 1 Hz, but as fast as 100 Hz or more.
Version 1.1 of ICM, released in January 2021, includes numerous new buses, and query types, as well as two major new features: Initialization and Output. The Initialize functionality allows ICM to be configured to send configuration information to the instrument/device when the program starts, which greatly expands the number of instruments that can be successfully integrated with ICM. With Output channels, ICM can now also write data to instruments, as well as read data from instruments. Other improvements to ICM include new example programs with various levels of complexity, the ability to store the raw data from an instrument in “streaming” .icm files and review that data (which can be useful for debugging in particular), improved documentation, and additional utilities for working with the ICM system.
OCC Program Prep
OCC Program Prep is a utility that assists in making autonomous data systems function correctly. It can be configured to execute any number of steps. Each step can perform one of the following actions: Wait, Wait Until Daq Device is Ready, Launch a Program, Sync to NTP Server, or Sync to GPS. Typical scenarios for OCC Program Prep are to wait until the operating system has fully initialized the NI DAQ Devices before launching the data acquisition program, and to synchronize the computer clock to a reliable external time source before launching the data acquisition program. For more information, see the OCC Program Prep page.
For pricing and purchasing information, please submit your request on our contact form.
FTP MLSD Command
FTP MLSD Command (LabVIEW 2015) When I was writing an FTP client VI, I found that some file servers would return nothing in response to the LIST (directory list) command if the directory name had spaces in it. This issue has been found before and is discussed on NI's forums. This download is my attempt at implementing the FTP MLSD command. MLSD is not recognized by all FTP servers, so logic is included to first try the MLSD, then the LIST command. These VI's are not completely polished, but should serve as a useful starting point if you run into the same FTP issue. Hopefully NI will incorporate this functionality in a future release of LabVIEW.
myRio Audio Analyzer
myRIO Audio Analyzer (LV 2013) (1.7 MB, .vip) is distributed as a VIP, which is installed through the VI Package Manager, which is included with LabVIEW 2013 and above. The myRIO Audio Analyzer is a demonstration program for the NI myRIO platform, which allows the capture, display, analysis and archiving of two channels of audio of audio data. It also includes a playback feature, and echo effect, and various filters. More information can be viewed here.
OCC Compare Version Strings
OCC Compare Version Strings.vi (15KB, LV 2013) is used to compare version strings of the type "n.n.n.n" to tell if one string represents an earlier or later version than the other. For version strings, each "n" is interpreted as an integer. This function interprets each integer, so that version 1.11 is recognized as greater than version 1.2, for example. Note that missing minor versions are interpreted as 0, so that version 1.1.0 is equal to version 1.1. Also note that this VI is only designed to work with version integers of up to four digits. E.g. it can parse version 1.9999.1.0 correctly, but is not guaranteed to parse version 1.10001.1.0 correctly. In addition, this VI ignores insignificant formatting issues, such as extra spaces or leading zeros in any of the sub-versions.
Make Everything Visible
Make Everything Visible (21KB, LV 2009) is a small utility for use during the development of UI-intensive LabVIEW applications.This VI can be dropped on a block diagram of a top-level VI and is used to make all the controls and indicators on the top-level VI visible for development purposes. Often, such UI VIs have many elements that are made visible and invisible at different points during execution. Since many of them are invisible while editing, it can be difficult to know where to add or how to align new UI elements. Instructions for its use are included on the front panel of the VI.
Presentation Timer
The Presentation Timer program is intended to be used at conferences and meetings to indicate when an event or presentation should end. It can be run on a laptop and displayed either on the laptop screen or on a projector so that the presenter, chair, and audience have a clear view of when the time has expired. This version (2.0) of the program was written in LabVIEW 8.2 and has been compiled to run on Windows 2000 or XP. This program requires the LabVIEW 8.2 Run Time Engine (RTE). Two versions of the installer for this program are available, a 4.8 MB download that does not include the RTE, and a 57 MB download that does include the RTE. If you already have the LV 8.2 RTE installed on your computer, or if you want to get the LV RTE directly from National Instruments, use the smaller download. I apologize for the size of these downloads. As the LabVIEW program has grown and matured, the size of this type of compiled program has exploded. I will look at ways to reduce the size of these downloads in the future.
New features in version 2.0 include the ability to play a .wav sound file when an alarm goes of, a graphical interface for configuring the timers and options, a time-of-day clock mode, and features that make it possible to use this timer on the same computer as the presentation (e.g. Powerpoint).
Version 2.0 of the Presentation Timer is Shareware. You may try it for up to three weeks. If you choose to continue using the program after that point, please see the Register menu item in the program for instructions on registering the program. Registration costs $10.00.
Downloads:
Presentation Timer ver 2.0 for Windows (58 MB) (installer includes LV-RTE, sample sounds, and instructions)
(Note that when this version is installed, a license agreement appears. This license refers to the LabVIEW Run Time Engine.)
Presentation Timer ver 2.0 for Windows without RTE (4.8 MB) (includes instructions and sounds)
Presentation Timer Instructions
OCC Sync UTC Time
The OCC Sync UTC Time program provides a simple interface for synchronizing a Windows computer to the time signal provided by an NTP server. Both time and date are synchronized to a sub-second accuracy. Note that this program sets the computer System Time to the UTC time on the NTP server. The computer time will be further adjusted according to the time zone selected in the OS.
The list of available NTP servers is determined by the OCC Sync UTC Time.ini file, located in the program directory. If this file is not present, it is created with a single NIST NTP server listed. To alter the list of NTP servers, edit the .ini file and add entries of the form
NTP n = xxx.xxx.xxx.xxx
where n is an integer starting with 0 and increasing sequentially andxxx.xxx.xxx.xxx is the IP address of an NTP server.
This software is freeware licensed under the Creative Commons Attribution-No Derivative Works 3.0 License (http://creativecommons.org/). It may be freely distributed and used as long as no derivative products are developed and the attribution to the original author remains intact.
Downloads:
OCC Sync UTC Time ver 1.0.0.1 for Windows (55MB) (This installs a built executable program with the LabVIEW Run-Time Engine and can be run on any Windows 2000 or XP system without additional software.)
OCC Sync UTC Time LabVIEW 8.2.1 source code version 1.0.0.1 (543KB) (This zip file includes the LabVIEW source code for the program, the dll that it calls, and all the project files required for building an executable and installer.)
Color Ramp Calculator
(LabVIEW 8.20) Color Ramp Calculator (56KB) is a set of three VIs that implement a simple interface for choosing a color ramp of up to 256 colors. This zip file contains three VIs. Color Ramp Calculator is the main working VI. The Choose Color Ramp.vi (shown on the right) is an implementation of a user dialog showing how the Color Ramp Calculator can be used. The Color Component Generator is a sub-vi used by the Color Ramp Calculator and is a modification of a VI distributed by National Instruments in an example. Compared to NI's color ramp interface, this implementation has two advantages: the user interface is simpler, and it is able to generate a color ramp of any number of elements up to 256.
Truncate Long PAth
(LabVIEW 8.20) The purpose of this VI is to be able to display long file paths optimally in a short string indicator. As shown in the image on the right, a path is used as input, and the output is a string which is sized to fit in the desired indicator. The Font, Font Size, and Font Style are taken into account when fitting the path into the indicator, as is the size of the indicator itself. The example VI shown to the right is included in the Truncate Long Path (42KB) download, along with the sub-vi that does the work.
Note that although the subVI is technically platform independent, the logic used to truncate the file path assumes Windows path syntax. Also, this VI is intended to work with single line string indicators.
A version of this VI that has been converted to an XControl is available on the LAVA website.
Correlation Plot
It is not easy to make a correlation plot in LabVIEW in which two quantities are graphed relative to each other, with each point color coded according to a third quantity. With the advent of XControls in LabVIEW 8, it became possible to implement such a graph in a way that is easy for other programmers to use. This Correlation Plot XControl (LV 8.2.1) (636 KB)includes an example program showing how to use the XControl as well as a short document describing the XControl and its properties.
Version 1.1.1 posted 10/22/07 contains minor cosmetic improvements.
Angle Between Lines
Angle Between Lines (LV 8.2.1, 35KB) is used to calculate the angle in radians between two lines in three dimensions that both pass through the origin. In addition to the simple calculation sub-vi, an example program (shown to the right) is included to help visualize how it works. Note that this example program uses the LabVIEW 3D Graph, and so cannot be used in the LabVIEW Base package.
This program was updated to version 1.1 in February, 2008, to correct a wiring error in the example VI.
Log File Component
The Log File Component (LabVIEW 7.1) (134 KB) is a small set of VI's that implement a simple example of a LabVIEW component using an architecture that I have developed and used on numerous projects. (See Conway and Watts, A Software Engineering Approach to LabVIEW for more information on LCOD, or LabVIEW Component Oriented Design.) In addition to providing an example of this architecture (which is the evolution of the Drivers discussed in my paper on the Mass Spectrometer program), this component can be used to easily implement an error and event logging mechanism. Additional information on how to use the component is included with the download or can be view here.
Sync Two DAQs
For a recent project, I needed to synchronize data acquisition from two USB Daq devices. Although NI has some great examples for synchronizing PCI and PXI Daq devices using internal signal routing, synchronizing USB or other external devices requires making physical wiring connections between the two units. This example (written in LV 2012) shows the extra configuration calls necessary to set up synchronized data acquisition from two USB devices, and includes an important subtlety about the resulting data.
The screen shot to the right shows the example program Sync Two DAQs running with two USB-6218-OEM boards, with 14 channels on each. A square wave signal was connected to the first channel of each board, and the data around one edge of the square wave was zoomed in to verify that the edge occurred at the same point on both DAQ Devices.
Gaussian Beam Calculator
The Gaussian Beam Calculator (LV 6.0) or Gaussian Beam Calculator (LV 8.2) is a program I wrote for calculating the propagation of a Gaussian (laser) beam through a series of simple lenses. The user specifies the wavelength, the initial beam waist and position, and (optionally) M2. The program then calculates the transformation of the beam as it encounters each lens (positive or negative focal length), yielding a new waist and position. The results are presented in a table and graphically. Configurations of lenses can be saved and reopened later, and results can be exported to ASCII (Excel-compatible) files. There is no fixed limit to the number of lenses that can be analyzed.
This program is available either as LabVIEW VIs (LV 6.0.2) (307 KB), LabVIEW VIs (LV 8.2) (433 KB), an executable for LV 6.0.2 (685 KB) or as an executable for LV 8.2 (3.8 MB). The LabVIEW 6.0.2 VIs require the Utility VIs, which are no longer available here for download. A small edit can remove this dependency. (Also note that in the LV version, it is possible for one of National Instruments' VI's to become unlinked, depending on where you install the VI's. To launch the help file display, this program uses the Open URL in Browser.vi which is located under LabVIEW/help/_browser.llb It may be necessary to relink this VI to get the program to run.) The LabVIEW 8.2 source code has the Utility VIs built into the same download.
The executable version does not require that LabVIEW be installed on the end-user's computer, but does require that the LabVIEW run-time engine be installed. The LabVIEW run-time engine is free and can be downloaded from National Instruments, by navigating through Download Software/Drivers and Updates/All Software Versions/LabVIEW/platform/Run Time Engine, or by going through their ftp site at ftp.ni.com and navigating through Support/LabVIEW/Runtime/(platform). (I cannot supply a direct link to their web download since their addresses are dynamic and it may be necessary to register in order to access the download. Registration is not necessary if you go through their ftp site.) Note that the correct version (6.0.2 or 8.2) of the Run Time Engine is required. If you download a different version instead, the executable version of the Gaussian Beam Calculator will not operate. If you already have one of the required versions of the LabVIEW Run Time Engine installed on your computer, then choose the appropriate version of the Gaussian Beam Calculator and you won't need to install the RTE again.
Version 1.2 of the Gaussian Beam Calculator, posted 20020128, fixes a small bug in the Units menu that manifested itself when previously-saved files were read into the program.
The help file describing the program (which is included in the downloads) can be viewed here.
NonLinear Fit
NonLinear Fit (LV 6.0, 201 KB) is an example of how to use the Nonlinear Lev-Mar Fit sub-vi's that are part of National Instruments Advanced Analysis package to fit data to a Gaussian peak shape. As inputs, the VI takes two arrays: the X coordinates and the Y data. The VI then fits these arrays to a Gaussian peak of the form y=a0*exp(-2.772589*((x-a1)/a2)^2)+a3. In order to have a good chance at having the fit converge, the VI makes estimates for the initial values of the coefficients a0 (Amplitude), a1 (Peak Position), and a2 (Full-Width-Half-Max). a3 (DC Offset) is assumed to be close to 0 and is not estimated. After the fit is calculated, the coefficients a0-a3 are returned, along with an array of calculated data based on the fit. The original data and the fit are displayed in a graph for comparison.
Note that the factor of 2.772589 scales the peak so that the width is expressed in terms of FWHM. If you wish other measures of the width, you can rescale the result or alter the VI as needed. Depending on your data, you may also wish to alter the calculations of the initial guesses for the coefficients. (E.g., you may need to calculate the DC Offset based on the first few and last few points of data, or you may want to smooth the data before calculating the initial guesses.)
Version 2.0, posted 20020914, is significantly revised and improved. In order to improve performance, the Target Function was rewritten so that it is called once for the entire array of data, rather than once for each point. This and other improvements were suggested by Christian Altenbach and Don Wagner. Christian and Don also assisted generously in testing these algorithms and made numerous helpful suggestions. Version 2.0 is significantly cleaner and more powerful than the older versions previously posted here. This version includes support for standard deviations for each data point, numerically calculated derivatives as well as analytical derivatives, and more than one target function definition. (The original Exponential function in NI's example is included as well as the Gaussian fit.) VI's written by Christian and Don use dynamically called target functions, which is a great way to support a large number of fitting functions. This version uses a type-def enum control to select which target function to use. It is fairly easy to edit the enum and the Target Function VI to add a small number of additional functions. In addition, this direct call is slightly more efficient than the dynamic call.