LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Record Data While Displaying Waveform

I am a student in a second semester LabView class.  I am attempting to create a program in which I display the temperature from a thermistor on a waveform chart continuously while having the ability to sample data to a .csv file in user specified sample times and recording time.  The problem I have ran into for the last two semesters is the ability to show the waveform feed while recording intermittently.  The chart will display, but after the recording is turned on the chart will pause until the specified recording time has been completed.  i.e. the loop for which the recording happens inside the program loop.  The program loop stops while the recording loop is executing.  I have put the recording program inside of event structures, case structures, etc...  each time the case structures is turned on the waveform will pause until the recording is over.  

 

Is it possible to display a running chart while saving data to a file without pausing the live feed?  

 

Below is the structure I am using to display a graph while recording data.  Of course this program will run continuously and overwrite or save a new file every X number of seconds as defined by the user.  I have tried to put this into a case structure, parallel while loops, etc...  

caklinedinst_0-1676237983872.png

 

Any advice would be greatly appreciated.  

 

0 Kudos
Message 1 of 3
(642 Views)

Avoid using the DAQ Assistant Express VI. You can get good shipping examples from Help >> NI Example Finder >> Hardware Input and Output >> DAQmx. See Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications.

NI-DAQmx driver has a built-in function to log data to TDMS files. TDMS file is a binary file and saves more disk space. It can be opened using TDM Excel Add-In for Microsoft Excel Download.

If you absolutely must use another file format, use Producer/Consumer Architecture to offload the data processing and logging to another loop.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 3
(605 Views)

In your code the DAQ assistant VI captures data and displays it afterward, so if lets say your data acquisition takes a second the your VI appears to do nothing for a second and then BANG, 1 second of data appears on the graph immediately.

 

Another problem with the daq assistant VI that it always initializes and closes a daqmx task which takes time, so its not just that you get the data in 1s chunks but also you miss part of the signal between the iterations. This would be very visible if you want to capture a sine wave: you will see that the data on the graph misses some parts of the signal.

 

Familiarize yourself with the DAQmx VIs. Its quite intimidating at the first sight, but in fact its not that complicated at all. One example out of the many is "current - continuous input" what you can find in the NI example finder. This helps you getting continous data from your device.

 

If you want seamless display even when you do a file operation then you need to use (at least) two parallel loops, one for the acquistion and the other one for the file operation. The best for you is probably the Producer - consumer design pattern. If you go to file menu -> new (not new VI!) then you can find the producer-consumer template under "from template" -> "design patterns"

The basics are super easy, but one can get intimidated by it cause it breaks the traditional dataflow of labview.

0 Kudos
Message 3 of 3
(584 Views)