Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
What is Developer Zone?
United States

Document TypeTutorial
NI Supported: Yes
Publish Date: Aug 17, 2012


Feedback


Yes No

Related Categories

Products

Related Links - Developer Zone

Related Links -Products and Services

Continuous Measurement and Logging Sample Project Documentation

0 Ratings | 0.00 out of 5
Read in  |  Print |  PDF

Table of Contents

  1. Developer Walkthrough
  2. System Requirements
  3. Use Cases
  4. Running this Sample Project
  5. Modifying this Sample Project
  6. Important Information

The Continuous Measurement and Logging sample project acquires measurements continuously and logs them to disk. It executes five loops in parallel:

  • Event handling (Main.vi)—The Event Handling Loop (EHL) that produces messages based on front panel events, such as the user clicking Start or Settings.
  • User interface messaging (Main.vi)—A Message Handling Loop (MHL) that receives messages from the EHL and responds by sending messages to the other MHLs.
  • Acquiring data (Acquisition.lvlib:Acquisition Message Loop.vi)—An MHL that continuously acquires data. By default, this template simulates acquired data.
  • Logging data (Logging.lvlib:Logging Message Loop.vi)—An MHL that continuously logs acquired data.
  • Displaying data (Main.vi)—A While Loop that updates the waveform chart with acquired data.

This sample project also features a Settings dialog box (Settings.lvlib) you can use to configure the application.

This sample project is based on the Queued Message Handler template. Refer to the Queued Message Handler template and its documentation, available from the Create Project dialog box, for information about how this template works.

Developer Walkthrough

See a developer walkthrough of the Continuous Measurement and Logging sample project.

System Requirements

LabVIEW Base, Full, or Professional Development System. This sample project is designed for use with NI-DAQmx, an instrument driver, or other driver software.

Use Cases

The Continuous Measurement and Logging sample project is designed for a continuous measurement application that requires a responsive user interface; that is, users should be able to click buttons even while the application is executing another command.

Running this Sample Project

  1. In the Project Explorer window, open and run Main.vi.
  2. Click Start. The program begins acquiring simulated waveform data.
  3. Click the other front panel buttons to explore the sample project.

Modifying this Sample Project

Adding Data Acquisition Code

You must modify the sample project to acquire data from hardware. Complete the following steps to make these modifications:

  1. Add hardware refnums to Acquisition.lvlib:Hardware Configuration.ctl. For example, you can use the following objects here:
    • DAQ tasks
    • DAQ channels
    • VISA sessions
  2. Add hardware initialization code to Acquisition.lvlib:Initialize Hardware References.vi. For example, you can use the following objects here:
    • DAQmx Task Name constants
    • DAQmx Create Virtual Channel VI
    • (Instrument Driver) Initialize VI
  3. Add hardware configuration code to Acquisition.lvlib:Configure Hardware.vi For example, you can use the following VIs here:
    • DAQmx Timing VI
    • DAQmx Trigger VI
    • (Instrument Driver) Configure Measurement VI
    • (Instrument Driver) Configure Autozero VI
  4. Add data acquisition code to Acquisition.lvlib:Acquire.vi. For example, you can use the following VIs here:
    • DAQmx Read VI
    • (Instrument Driver) Read VI
  5. Add code that stops data acquisition to Acquisition.lvlib:Stop Acquisition.vi. For example, you can use the following VIs here:
    • DAQmx Clear Task VI
    • (Instrument Driver) Close VI

Customizing Data Logging Code

If the default logging behavior does not meet the needs of your application, you can modify this sample project in the following ways:

  • To specify where data is logged, run Main.vi, click Settings, and use the Log File Path control. By default, this template logs data to LabVIEW Data\Logged Data.tdms, where LabVIEW Data is the LabVIEW Data folder.
  • To change the data logging mechanism, modify Logging.lvlib:Logging Message Loop.vi. For example, you could modify this VI to stream acquired data across a network or to disk.
  • To change the code that writes data to disk, modify Logging.lvlib:Log Data.vi. For example, you could use the Export Waveforms to Spreadsheet File or Write to Spreadsheet File VIs. By default, this template uses the TDMS functions to log data to a .tdms file.
  • To change or add path and file refnums that are needed for data logging, modify Logging.lvlib:Logging Configuration.ctl.

Important Information

Copyright

© 2012 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:

  • Notices are located in the <National Instruments>\_Legal Information and <National Instruments> directories.
  • EULAs are located in the <National Instruments>\Shared\MDF\Legal\license directory.
  • Review <National Instruments>\_Legal Information.txt for information on including legal information in installers built with NI products.

Trademarks

LabVIEW, National Instruments, NI, ni.com, 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.

0 Ratings | 0.00 out of 5
Read in  |  Print |  PDF

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).