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

advertisement
LabVIEW Real-Time Waveform Acquisition and Logging (NI-DAQmx) Sample Project Documentation
Publish Date: Aug 21, 2012
Overview
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.
Table of Contents
1.
2.
3.
4.
5.
6.
Features
System Requirements
Overview
Running This Sample Project
Adapting the Sample Project to Your Hardware
Important Information
1. Features
Headless operation with optional user interface—The user interface VI interacts with the real-time controller and displays da
This VI can connect and disconnect from the device at any time without affecting the acquisition and logging loop.
Triggered data logging—The real-time VI logs acquired data to disk as TDMS files when a trigger condition is met. This sam
project also manages the amount of disk space being used.
Error handling—The application reports and logs all errors from the real-time controller, shutting down on any critical error.
This sample project is based on the Simple State Machine (http://www.ni.com/white-paper/14120/en) and Queued Message
Handler (http://www.ni.com/white-paper/14119/en) templates. Refer to the Simple State Machine and Queued Message Handle
templates and their documentation, available from the Create Project dialog box, for information about how these templates w
2. System Requirements
Development System
LabVIEW Full or Professional Development System
LabVIEW Real-Time Module
NI-DAQmx device driver software
Real-Time Target, such as an NI PXI Chassis or an NI CompactDAQ System
Software:
LabVIEW Real-Time
Network Streams
Network Variable Engine
NI System Configuration
NI-DAQmx
NI-Watchdog
Hardware: A DAQ device. This sample project is designed for an NI PXI DAQ device with at least four analog input channels
3. Overview
This sample project consists of eight parallel loops on two execution targets. The following loops run in parallel on the desktop
computer:
Handling events from the user interface (UI Main.vi - Event Handling Loop)—Produces messages to the UI Message Loop
based on front panel events.
Handling messages from the user interface and the real-time controller (UI Main.vi - UI Message Loop)—Receives and
responds to messages from the Event Handling Loop and, using network streams, the RT Message Handling Loop.
Displaying messages and data from the real-time controller (UI Main.vi - Monitoring Loop)—Displays the latest values of
information acquired from RT Loop - System Health and Monitoring.vi.
The following loops run in parallel on the real-time controller:
Handling commands from the user interface (RT Loop - UI Commands.vi)—Reads commands that are sent from UI Main.vi
the development computer and produces the appropriate messages.
Handling messages from all loops on the real-time controller (RT Main.vi - Message Handling Loop)—Consumes messages
from all loops that run on the real-time controller.
Ensuring the RT controller remains responsive (RT Loop - Watchdog.vi)—Pets the watchdog, ensuring the RT controller
remains responsive.
Monitoring diagnostic information from the real-time controller (RT Loop - System Health and Monitoring.vi)—Monitors CPU
and memory usage of the real-time controller. This information is written to network-published shared variables and appears
the System Monitoring tab of UI Main.vi.
Acquiring and logging data from the DAQ device (RT Loop - Acquisition and Logging.vi)—Initializes the DAQ device, reads
data from it, and logs acquired data.
4. 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.
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.
6. Run RT PXI Target»RT Main.vi. This VI begins acquiring data and logging it using the configuration settings in Config.xml.
1/3
www.ni.com
6.
7.
8.
9.
Run RT PXI Target»RT Main.vi. This VI begins acquiring data and logging it using the configuration settings in Config.xml.
Open and run My Computer»UI Main.vi.
Enter the IP address of the real-time controller in the Controller Address text box and click Connect.
After you are connected, 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.
5. 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:
Error Handlers folder
Globals folder
RT Loops folder
Support VIs folder
Type Definitions folder
Shared Variables.lvlib
RT Main.vi
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:
DAQ Close.vi
DAQ Initialize.vi
DAQ Read.vi
Configuring Sample Project Settings
In the Project Explorer window, open My Computer»Globals»Global - Configuration Options.vi and configure the sample
project settings.
6. 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
copyright and other intellectual property laws. Where NI software may be used to reproduce software or other materials belong
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, 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 (
http://www.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 (http://www.ni.com/pate
).
PRODUCT
SUPPORT
COMPANY
Order status and history (http://www.ni.com/status/) Submit a service request (
https://sine.ni.com/srm/app/myServiceRequests)
Order by part number (
http://sine.ni.com/apps/utf8/nios.store?action=purchase_form
Manuals (http://www.ni.com/manuals/)
)
Drivers (http://www.ni.com/downloads/drivers/)
Activate a product (
http://sine.ni.com/myproducts/app/main.xhtml?lang=en
Alliance Partners (http://www.ni.com/alliance/)
)
2/3
About National Instruments (
http://www.ni.com/company/)
Events (http://www.ni.com/events/)
Careers (http://www.ni.com/careers/)
www.ni.com
Order and payment information (
http://www.ni.com/how-to-buy/)
MISSION
NI equips engineers and scientists with systems
that accelerate productivity, innovation, and
discovery.
(http://twitter.com/niglobal)
(
http://www.facebook.com/NationalInstruments)
(
http://www.linkedin.com/company/3433?trk=tyah)
(http://www.ni.com/rss/)
(
http://www.youtube.com/nationalinstruments)
Contact Us (http://www.ni.com/contact-us/)
(http://privacy.truste.com/privacy-seal/National-Instruments-Corporation/validation?rid=bc6daa8f-7051-4eea-b7b5-fb24dcd96d95)
Legal (http://www.ni.com/legal/) | © National Instruments. All rights reserved. | Site map (
http://www.ni.com/help/map.htm)
3/3
www.ni.com
Download