Summary: In this exercise, the objective is to learn to use a LabVIEW Measurement File. Complete the following steps to modify the Measurement Averaging VI to log the acquired data to a LabVIEW Measurement File. Create another VI that reads the data file.
EXERCISE 1
1.A) Simple Data Logger Block Diagram
- Open the
Measurement Averaging VIlocated in theC:\Exercises\LabVIEW Basics Idirectory. - Modify the block diagram to log the acquired data as shown in Figure 1.
Figure 1 Place the
Write LabVIEW Measurement FileExpress VI, located on theFunctions>>Outputpalette, on the block diagram. This Express VI stores the data acquired from the DAQ device. In theConfigure Write LabVIEW Measurement Filedialog box that appears, set the following options:- Set the
ActiontoAsk user to choose filefor the filename. - Set the
Segment HeaderstoOne header onlyto provide a header for all of the data. The header contains information about the sampling rate and the time when the sample was taken. - Set
X Value ColumnstoOne column per channelto provide a table of data that can be read by any spreadsheet editor or an ASCII text file editor. - Set the
DelimitertoTabto make it easy for a spreadsheet editor to determine where a column of data starts in the file. - Click the
OKbutton to close the dialog box.
Place the
Merge ErrorsVI, located on theFunctions>>All Functions>>Time & Dialogpalette, on the block diagram. It is important to catch errors with both DAQ and file I/O, and because the code has a parallel structure it is necessary to merge the errors from all of the parallel operations to determine if the code is functioning properly. - Set the
- Select
File>>Save Asto save the VI asSimple Data Logger.viin theC:\Exercises\LabVIEW Basics Idirectory. - Run the VI. A filename prompt appears. Name the file
logger.lvmin theC:\Exercises\LabVIEW Basics Idirectory. - Stop and close the VI.
1.B) Simple Data Reader Front Panel
- Open a blank VI and build the front panel shown in Figure 2 by placing a waveform chart, located on the
Controls>>Graph Indicatorspalette, on the front panel.
1.C) Block Diagram
- Build the block diagram shown in Figure 3.
Figure 3 Place the
Read LabVIEW Measurement FileExpress VI, located on theFunctions>>Inputpalette, on the block diagram. Because this Express VI reads data located in a LabVIEW measurement file one data point at a time, it must be placed in a loop. In theConfigure Read LabVIEW Measurement Filedialog box that appears, set the following options:- In the
Actionsection, place a checkmark in theAsk user to choose filecheckbox. - Set the
Segment SizetoRetrieve segments of original sizeso that all the data stored in the file is retrieved. - Set
Time StampstoRelative to start of measurement. Because the dynamic data type stores information about the signal timing, this setting aligns the data with the time of the measurement. - In the
Generic Text Filesection, remove the checkmark from theRead generic text filescheckbox because the data is stored in a LabVIEW measurement file. - Click the
OKbutton to close the dialog box.
- In the
Place the
Unbundle by Namefunction, located on theFunctions>>All Functions>>Clusterpalette, on the block diagram.Place the
Orfunction, located on theFunctions>>Arithmetic & Comparison>>Express Booleanpalette, on the block diagram.- Wire the
EOF?output of theRead LabVIEW Measurement Filefunction to theOrfunction. Wire thestatusoutput of the error cluster to the second input of theOrfunction. This stops theWhile Loopwhen the entireLabVIEW Measurement Filehas been read or when an error occurs.
- Save the VI as
Simple Data Reader.viin theC:\Exercises\LabVIEW Basics Idirectory. - Display the front panel, and run the VI. In the filename prompt that appears, select the
logger.lvmfile that you created earlier. - The data that was stored in the LabVIEW Measurement File appears in the waveform chart.
NOTE:
You might need to rescale or autoscale the y-axis of the waveform chart to display the data. - Close the
Simple Data ReaderVI.
No comments:
Post a Comment