LabVIEW VIs


LabVIEW 8.5 About Box

Here are some VIs and other software, that I am making available to the LabVIEW community. Please give credit where credit is due! I am making these available in various formats, if you don't see a version that you need let me know and I can convert it either up or down versions. However, these are presented in the version that they have been tested in. Please send any suggestions or corrections to me.

Read and Set Front Panel Controls

This set of VIs allows setting of a front panel control with signalling for event driven VIs either on the same system or remotely. It recursively searches container controls for the target control name. The companion VI reads a control by name and returns the value as a variant. This pair of VIs allows a VI to operate either a local or remote VI just as if an operator was using a mouse and keyboard.
Read-Set Controls.zip, LabVIEW 8.5 Version

Close Some Modal VIs

Occasionally during development one will open a modal VI that is part of a running hierarchy. There is no way to close such a VI without force-quitting LabVIEW. Simply run this VI and it will also run as a modal VI giving you a choice of VIs to close.
Close Some Modal Running VIs

Serial Port Handler

These series of VIs are for handling all the tasks on a serial port. They encapsulate all the functions into a single VI. The VIs come in two versions a large and somewhat cumbersome setup using traditional VIs and a smaller set using VISA. The VISA versions are almost a drop in replacement for the traditional ones. The only difference is that the traditional ones use an integer as a serial port number and the VISA ones use a VISA I/O reference. These functions have their start on the old NLSerial library by Albert Geven. I started by adding error clusters on the in and out terminals and went from there. I also added some of the functionality of the sundial serial libraries by Andrew The mechanism for locking is somewhat of a kludge under the traditional serial port VIs. The functions are:
  1. Init - Sets the serial port parameters and opens the port. The traditional VI library includes some Mac only VIs for setting baud rates > 56k. In the VISA version either a port number or a VISA I/O refererence can be used to designate a port.
  2. Break - Sends a break on the serial port
  3. Clear Buffer - Discards both transmit and receive buffers. Be sure to have latest VISA (version 2.6 or greater) to avoid a bug.
  4. Write - Writes the string to the port. The termination string is appended.
  5. Read - Reads from the serial port until maximum characters are read, the timeout limit expires, or the termination character is encountered. The entire string including the termination character is returned.
  6. # Bytes - Returns the number of bytes waiting in the serial port buffer.
  7. Lock - Locks the resource. This will wait for the timeout time for the resource to become available. An error is returned if the attempt to lock the resource fails.
  8. Unlock - Unlocks the resource, the obvious
  9. Close - Closes the serial port and releases it.
Two VIs are also provided. "Serial Write/Read" will send a command and return the response. The port must have been previously initialized. A time for the device to respond is waited between the write and read attempts. The port is locked during this process so a variety of higher level VIs can execute this VI without interleaving the responses.

The other VI, "Serial Terminal", I included is a very simple terminal emulator for checking out serial communication. It places the transmit and received characters in different controls.
Traditional Library, LV 6 (Deprecated!)
VISA Library, LV 6
VISA Library, LV 6.1

VISA Serial Test

This VI sends a lot of bytes thru the serial port at a bunch of different packet sizes. It exercises the port at a bunch of different baud rates. Hook up a null modem cable between the two ports and let 'er rip! This will give you the overall thruput for the serial ports. There is a version that sends simultaneously in both directions (full duplex).
Half Duplex: Version 6, Version 6.1
Full Duplex: Version 6, Version 6.1

VI Hierarchy

Given a top level VI, this will list all the VIs in the hierarchy and sort by various properties. Shows paths, reentrancy, priority etc. Easily extensible to other properties. Version 6, Version 6.1

Extract_Doubles

This VI extracts any numbers embedded in a string into an array of doubles. it supersedes the ones from NI in the examples/general/strings.llb for two reasons. It returns double precision numbers, and it actually works and will not hang as many of the NI versions do. Version 6, Version 6.1

Directory Statistics

This is an example of a directory walking routine. It will dive down thru directory structures building a list of files to process. It will then process them as a linear list. This example accumulates the number of files that are locked or include CINS. Extra credit for folks who can figure out how I was able to count files with CINS. Version 6, Version 6.1

Recursion

Yes, Virginia, there is recursion in LabVIEW. Here is an implementation of the classic definition of the factorial function as a recursive function. Go wild with your own implementation. If I have the time I will modify the directory walking VI above to be recursive. Version 6, Version 6.1

Non-Blocking AI Read

The AI Read function is badly designed. It is a CIN that hangs the whole system waiting for data. So if that happens first then the whole thing hangs until the data comes in and then needs to update front panels etc. There are a bunch of replacement drop ins for ai-read out there. (I have written a few) that read a length 0 number of scans and check the back log to see if there is enough data to satisfy the read then only does the read when there is enough. On the "incorrect" platform there is an ability to use daq occurrences which will wait for the read to be satisfied. It is a drop in replacement for AI Read. It has a system constant for a timeout in the case that it is passed a -1 as a timeout. You may need to mess with that for your application. Someday I will fix it up so it does its own calculation of the time out needed. Version 6, Version 6.1

Drivers for Lake Shore DRC 93C/82C Temperature Controller

This library has routines for reading the sample and control values of the Lakeshore temperature controller. There is also a routine for downloading temperature calibration curves into the memory. And one for writing the setpoint value. This is a very old set of VIs but I believe it still works under LV 6.1. Version 6.1 [an error occurred while processing this directive]