LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fast Data Acquisition VI

Solved!
Go to solution

I am trying to make a VI that can create a .csv, write to the .csv, and record at set intervals.  This is to replace some older Windaq hardware and software that has been in use for many years and is becoming harder to get support for.  And some Labview hardware was ordered ages ago but never utilized of which, I have a NI 9223 module and 9171 plugged via usb to a computer.

 

What I am trying to emulate with Labview is a VI that can display voltages (which I have not created yet), graphs for viewing the signal, and a logger that records the data.  The problem I am encountering is I can write to the .csv but I do not get the time intervals that correlate with the frequency.  I want a .csv that has the elapsed time from start (zero) in the left most column with adjacent columns in the same row having the voltage reading.  

 

I'll take the criticisms my ignorance warrants.

Download All
0 Kudos
Message 1 of 5
(128 Views)
Solution
Accepted by topic author DePeppers

One Big Loop is not a proper program architecture. The main problem with OBL is your data acquisition speed will be limited by the time it takes to write the data to a file every iteration

 

If you want to do high speed data acquisition and save it to disk you need to use a proper program architecture like a Producer/Consumer.

 

Basically your DAQ will run in the Producer loop and put data into a Queue or Channel Wire.

This allows the DAQ to run full speed.

 

The Consumer loop will Dequeue the data, process, display and save it to disk withiest limiting the acquisition speed or dropping any data. 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 5
(123 Views)

Issues:

You need to use DAQmx functions, not the assistant. Set up the task outside the loop, then start it, read inside the loop, the close task after the loop. You can use a Producer Consumer as suggested, but I would suggest using the built in logging features of DAQmx. You can save directly to a TDMS file, then convert it to CSV after the acquisition is complete.

 

Also you want your Read to be about 100ms of data, so for a 500k rate you should be reading about 50k samples at a time. Your current setup, saving to CSV in the loop, reading 100 samples at time, DAQ Assistant, you will never run for more than a few iterations without error.

 

I highly suggest that you look in the Example Finder for Voltage Continuous Acquisition Example, that will get you 99% of the way there.

0 Kudos
Message 3 of 5
(95 Views)

I've looked into Producer/Consumer loops and copied one to perform acquisition.  I am using a queue and write to delimited file VIs to hold the data and to write to a measurement file.  I still do not have an elapsed in the file but I'll figure it out.

0 Kudos
Message 4 of 5
(48 Views)

Thank you for the insight, I had thought I could get by with only using the DAQ assistant.  I now have a basic understanding of DAQmx functions and am using them to collect data at a higher sample rate.  I am using a Producer loop that reads data, queue the elements, and a Consumer loop that creates a .csv file with the collected samples.

 

Message 5 of 5
(46 Views)