LabVIEW Real-Time Waveform Acquisition and Logging (NI-DAQmx)

The LabVIEW Real-Time Waveform Acquisition and Logging (NI-DAQmx) sample project uses NI-DAQmx code to acquire continuous waveform data. This sample project also uses LabVIEW Real-Time Module code to log this data to disk.

Features

System Requirements

Development System

Real-Time Target, such as an NI PXI Chassis or an NI CompactDAQ System

Overview

This sample project consists of eight parallel loops on two execution targets. The following loops run in parallel on the desktop computer:

The following loops run in parallel on the real-time controller:

Running This Sample Project

  1. Adapt the sample project to your hardware.
  2. In the Project Explorer window, open My Computer»Utility - Configuration File Generator.vi.
  3. Enter the configuration values that are appropriate for your application. Be sure to look at all the values in the TDMS Properties array. If you enable a trigger, logging begins when the specified time or value is reached.
  4. Run the VI. LabVIEW generates a configuration file, Config.xml, in the same directory as the .lvproj file.
  5. Transfer this XML file to the root folder of the real-time controller.
    1. Navigate to the IP address of your target device in a web browser.
    2. Click Remote File Browser.
    3. Select the root directory in the file tree.
    4. Click Upload File... and select the Config.xml file generated.
  6. Run RT PXI Target»RT Main.vi. This VI begins acquiring data and logging it using the configuration settings in Config.xml.
  7. Open and run My Computer»UI Main.vi.
  8. Enter the IP address of the real-time controller in the Controller Address text box and click Connect.
  9. After connecting to the device, start the acquisition process by clicking Force Trigger and display live data in the waveform chart by clicking Acquire Live Data. Change the Live Data Channel control to see live data from different channels.
  10. Click Exit to exit the application.

Adapting the Sample Project to Your Hardware

  1. Ensure all devices are configured and connected to the same network as the development computer.
  2. In the Project Explorer window, add or discover your RT target to the to the top-level project item.
  3. Drag the following project items from the default RT target to the one you added in step 2:
  4. Delete the default RT target project item that no longer has any VIs associated with it.
  5. Customize the code in the following places to communicate with your DAQ device:

Configuring Sample Project Settings

In the Project Explorer window, open My Computer»Globals»Global - Configuration Options.vi and configure the sample project settings.

Modifying This Sample Project

If the default logging behavior is too slow for your application, you can use the DAQmx Start New File and DAQmx Configure Logging VIs. Refer to the VI documentation for more information.

Additional Resources

Refer to the LabVIEW Help, available by selecting Help»LabVIEW Help for information about LabVIEW concepts or objects used in this sample project. You can also use the Context Help window to learn basic information about LabVIEW objects as you move the cursor over each object. To display the Context Help window in LabVIEW, select Help»Show Context Help

Refer to ni.com for a developer walkthrough of the LabVIEW Real-Time sample projects.

This sample project is based on the Simple State Machine and Queued Message Handler templates. Refer to the Simple State Machine and Queued Message Handler templates and their documentation, available from the Create Project dialog box, for information about how these templates work.


Important Information

Copyright

© 2013 National Instruments. All rights reserved.

Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation.

National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by copyright and other intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to others, you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction.

End-User License Agreements and Third-Party Legal Notices

You can find end-user license agreements (EULAs) and third-party legal notices in the following locations:

Trademarks

LabVIEW, National Instruments, NI, ni.com, NI CompactDAQ, the National Instruments corporate logo, and the Eagle logo are trademarks of National Instruments Corporation. Refer to the Trademark Information at ni.com/trademarks for other National Instruments trademarks.

Other product and company names mentioned herein are trademarks or trade names of their respective companies.

Patents

For patents covering the National Instruments products/technology, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your media, or the National Instruments Patent Notice at ni.com/patents.