Saturday, September 25, 2010

Simple Data Logger VI

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

  1. Open the Measurement Averaging VI located in the C:\Exercises\LabVIEW Basics I directory.
  2. Modify the block diagram to log the acquired data as shown in Figure 1.
    Figure 1
    Figure 1 (simpledataloggerbd.png)
    writelvm.png Place the Write LabVIEW Measurement File Express VI, located on the Functions>>Output palette, on the block diagram. This Express VI stores the data acquired from the DAQ device. In the Configure Write LabVIEW Measurement File dialog box that appears, set the following options:
    1. Set the Action to Ask user to choose file for the filename.
    2. Set the Segment Headers to One 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.
    3. Set X Value Columns to One column per channel to provide a table of data that can be read by any spreadsheet editor or an ASCII text file editor.
    4. Set the Delimiter to Tab to make it easy for a spreadsheet editor to determine where a column of data starts in the file.
    5. Click the OK button to close the dialog box.
    mergeerrorsicon.png Place the Merge Errors VI, located on the Functions>>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.
  3. Select File>>Save As to save the VI as Simple Data Logger.vi in the C:\Exercises\LabVIEW Basics I directory.
  4. Run the VI. A filename prompt appears. Name the file logger.lvm in the C:\Exercises\LabVIEW Basics I directory.
  5. Stop and close the VI.

1.B) Simple Data Reader Front Panel

  1. 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.
Figure 2
Figure 2 (simpledatareaderfp.png)

1.C) Block Diagram

  1. Build the block diagram shown in Figure 3.
    Figure 3
    Figure 3 (simpledatareaderbd.png)
    1. readlvm.png Place the Read LabVIEW Measurement File Express VI, located on the Functions>>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 the Configure Read LabVIEW Measurement Filedialog box that appears, set the following options:
      • In the Action section, place a checkmark in the Ask user to choose file checkbox.
      • Set the Segment Size to Retrieve segments of original size so that all the data stored in the file is retrieved.
      • Set Time Stamps to Relative 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 the Read generic text files checkbox because the data is stored in a LabVIEW measurement file.
      • Click the OK button to close the dialog box.
    2. unbundle.png Place the Unbundle by Name function, located on the Functions>>All Functions>>Cluster palette, on the block diagram.
    3. or.png Place the Or function, located on the Functions>>Arithmetic & Comparison>>Express Boolean palette, on the block diagram.
    4. Wire the EOF? output of the Read LabVIEW Measurement File function to the Or function. Wire the status output of the error cluster to the second input of the Or function. This stops the While Loop when the entire LabVIEW Measurement File has been read or when an error occurs.
  2. Save the VI as Simple Data Reader.vi in the C:\Exercises\LabVIEW Basics I directory.
  3. Display the front panel, and run the VI. In the filename prompt that appears, select the logger.lvm file that you created earlier.
  4. 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.
  5. Close the Simple Data Reader VI.

Content actions

GIVE FEEDBACK:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers