Example Code

Analog Input at Varying Rates with Write to Multiple Descriptive Named Files

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

This is a simple DAQ program which will run an analog input multiple different times at varying specified rates, then output the data to a series of files with the rate as a portion of the name for easy identification later. 

  

Description

This would be useful in a testing situation to figure out how quickly to sample to get a good description of the signal, or get varying descriptions of a signal of unknown frequency. It also can be handy for integrating into programs which need similar functionality to the file series write.The Auto indexed for loop is passed a series of rates, which will be indexed through on each iteration of the loop.The DAQ is setup using the current rate, the specified length of test, and the specified channels.Using the current rate, we build a file name of Test [rate].lvm. Upon completion of the DAQ and path building, the file is written to the name.Repeat until the array has been indexed through.

 

Requirements

Software

  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible

Hardware

  • NI Multifunction DAQ Device

Steps to Implement or Execute Code

  1. Open VI
  2. Select physical channe
  3. Specify path of choice on the block diagram to save the files
  4. Select rates and length of time to take data for
  5. Run the VI.

 

Additional Information or References

 

 

 

搜狗截图17年01月07日1400_2.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Regards,

Kyle M.
Applications Engineering
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.