• No results found

Writing a Test Sequencer

In document LabVIEW Tutorial Manual (Page 191-194)

Many production and Automated Test Executive (ATE) applications like the one you just examined require the automated sequencing of tests. Each test measures a particular characteristic of the unit under test (UUT) and compares that measurement to an expected limit. If the value is within the limit, the test passes. Otherwise, the test fails. A complete testing procedure for a UUT consists of a number of these tests executed sequentially. The following example shows how to build a test sequencer.

Front Panel

1. Open Test Sequencer.vi, located in examples\apps\

testseq.llb.

Ch8.fm Page 17 Thursday, August 24, 2000 10:57 AM

Chapter 8 Data Acquisition and Instrument Control

LabVIEW Tutorial Manual 8-18 © National Instruments Corporation

Block Diagram

1. Open the block diagram of the Test Sequencer VI as shown in the preceding illustration.

The test sequence consists of a string that the VI expands into a numeric array of tests to run. This array is passed to a While Loop that contains a Case structure. Each case contains a test VI that corresponds to a number in the test sequence string. The While Loop indexes through the array of test numbers, selecting the appropriate case index for each test. The Current Test Number indicator shows the test number currently executing. If a test fails and the operator has set Stop on fail to TRUE, the loop stops.

In this example, each test passes out a Boolean value that indicates whether or not the test passed. The Boolean is set to TRUE if the test passed and FALSE if it fails. The main test sequencer loop uses a shift register to keep a cumulative PASS/FAIL status for the entire testing sequence. When the loop stops executing, the test sequence displays the cumulative status in the Result indicator.

There are many extensions that you can make to this basic test sequencer. One common modification would be to store test sequences in files rather than display them in a front panel control. The operator could then load the specific test sequence that is appropriate for the current UUT. Some other common extensions include:

• Generating a text report of test results.

• Prompting the operator for a UUT serial number.

• Looping a test on failure.

Ch8.fm Page 18 Thursday, August 24, 2000 10:57 AM

Chapter 8 Data Acquisition and Instrument Control

© National Instruments Corporation 8-19 LabVIEW Tutorial Manual

You can add all of these capabilities to the basic test sequencer described in this example. However, you may want to obtain the LabVIEW Test Executive Toolkit, which contains a full-featured, test sequencer that implements not only the previously mentioned extensions, but also test dependencies, force conditions, and more.

Contact National Instruments for purchasing information regarding the LabVIEW Test Executive Toolkit.

Summary

There are many ways to acquire data with LabVIEW. GPIB is a useful method for communication with individual instruments. Serial port communication is a useful method for transferring data over long distances.

(Windows, Macintosh, and Sun) You can use VIs to control plug-in data acquisition boards and VXI systems.

(Windows, Macintosh, and Sun) You can learn more about using the data acquisition VIs for acquiring data with plug-in data acquisition boards from the LabVIEW Data Acquisition Basics Manual.

(All Platforms) Just as the GPIB VIs eliminate the need to have an in-depth knowledge of the IEEE 488 bus, the VIs in the LabVIEW Instrument Driver library eliminate the need to have an in-depth knowledge of a specific instrument. There are over 300 instrument drivers in the library. If you have an instrument that is not on the list, you can find a similar instrument and modify that instrument driver for your instrument.

VISA functions are the preferred method for controlling instruments, such as GPIB, VXI, and so on. Because VISA functions concentrate on the activities specific to the instrument, VISA controlled instrument drivers are considered to be interface independent.

The GPIB functions control GPIB communication. The commonly used functions are GPIB Write, GPIB Read, and GPIB Status. The GPIB Write function sends data to an instrument. The GPIB Read function reads data from an instrument. The GPIB Status VI returns the status of the GPIB when you execute the VI. Several other GPIB functions perform less common operations such as clearing a device, waiting for a service request, triggering a device, or polling a device.

Ch8.fm Page 19 Thursday, August 24, 2000 10:57 AM

Chapter 8 Data Acquisition and Instrument Control

LabVIEW Tutorial Manual 8-20 © National Instruments Corporation

You can control serial devices with the serial port VIs. There are only five serial port VIs. To control a serial device you use the Serial Port Init VI to configure the communication port. Then, you use the Serial Port Write VI to send a command string. You can wait until a set number of characters are in the buffer with the Bytes at Serial Port VI.

Finally, you read the data from the buffer with the Serial Port Read VI.

(Windows, Macintosh, and Sun) You can control VXI systems if you have the LabVIEW VXI Development System. For more information refer to the LabVIEW VXI VI Reference Manual.

LabVIEW has many string functions ideally suited for instrumentation programming. These functions help you easily convert data from one type to another, or extract numbers from strings.

When acquiring data and controlling instruments, you may have a particular test suite that controls your application. You can use the Test Sequencer example to build such a test suite. The LabVIEW Test Executive Toolkit is available as an add-on package if you want to have full control of your ATE application. Contact National Instruments for more information on the LabVIEW Test Executive Toolkit.

Additional Topics

In document LabVIEW Tutorial Manual (Page 191-194)

Related documents