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 VI
located in theC:\Exercises\LabVIEW Basics I
directory. - Modify the block diagram to log the acquired data as shown in Figure 1.Place the
Figure 1 Write LabVIEW Measurement File
Express VI, located on theFunctions>>Output
palette, on the block diagram. This Express VI stores the data acquired from the DAQ device. In theConfigure Write LabVIEW Measurement File
dialog box that appears, set the following options:Place the- Set the
Action
toAsk user to choose file
for the filename. - Set the
Segment Headers
toOne header only
to 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 Columns
toOne column per channel
to provide a table of data that can be read by any spreadsheet editor or an ASCII text file editor. - Set the
Delimiter
toTab
to make it easy for a spreadsheet editor to determine where a column of data starts in the file. - Click the
OK
button to close the dialog box.
Merge Errors
VI, located on theFunctions>>All Functions>>Time & Dialog
palette, 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 As
to save the VI asSimple Data Logger.vi
in theC:\Exercises\LabVIEW Basics I
directory. - Run the VI. A filename prompt appears. Name the file
logger.lvm
in theC:\Exercises\LabVIEW Basics I
directory. - 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 Indicators
palette, on the front panel.
1.C) Block Diagram
- Build the block diagram shown in Figure 3.
Figure 3 - Place the
Read LabVIEW Measurement File
Express VI, located on theFunctions>>Input
palette, 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 File
dialog box that appears, set the following options:- In the
Action
section, place a checkmark in theAsk user to choose file
checkbox. - Set the
Segment Size
toRetrieve segments of original size
so that all the data stored in the file is retrieved. - Set
Time Stamps
toRelative 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 File
section, remove the checkmark from theRead generic text files
checkbox because the data is stored in a LabVIEW measurement file. - Click the
OK
button to close the dialog box.
- In the
- Place the
Unbundle by Name
function, located on theFunctions>>All Functions>>Cluster
palette, on the block diagram. - Place the
Or
function, located on theFunctions>>Arithmetic & Comparison>>Express Boolean
palette, on the block diagram. - Wire the
EOF?
output of theRead LabVIEW Measurement File
function to theOr
function. Wire thestatus
output of the error cluster to the second input of theOr
function. This stops theWhile Loop
when the entireLabVIEW Measurement File
has been read or when an error occurs.
- Place the
- Save the VI as
Simple Data Reader.vi
in theC:\Exercises\LabVIEW Basics I
directory. - Display the front panel, and run the VI. In the filename prompt that appears, select the
logger.lvm
file 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 Reader
VI.
No comments:
Post a Comment