From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any data loss when I perform other operations during a event?

Solved!
Go to solution

Hi there. I'm a new user to NI-DAQ device.

Now I am developing a continuous AI sampling program for NI USB-6229.

 

The environment settings are 8 channels under 2kHz sampling frequency. In the program

I need to save the data to a csv file every once in a while, say, 500ms, through the "event"

mechanism. I tested that it takes about 32~48ms to write the data of 500ms.

 

This "event" seems like a software interrupt to me so I was wondering if the DAQ device

keeps recording new data while I perform the writing operation in the event?

 

Or put it in another way, when I configurate the sampling task with the function

"DAQmxCfgSampClkTiming", the parameter "sampsPerChanToAcquire" is described to

be used as a factor to determine the buffer size. Is this buffer the "AI FIFO" buffer referred

by the "M series user manual"? Does it mean if I set it to an appropriate value the data

will always go into this buffer first and then read by the computer, so if the transfer is fast

enough there would be no data loss?

 

Thank you in advance.

0 Kudos
Message 1 of 3
(2,833 Views)
Solution
Accepted by topic author HansonDon

The data is recorded by the DAQ device and stored in the FIFO buffer.  The DAQmx Read VI then takes the amount of data specified out of the FIFO and brings the data to your program level.  So as long as your buffer is large enough, you won't lose any data.

 

Here are some other suggestions.

 

Look into the Producer/Consumer architecture.  This is a way to put the file write into another thread so you can process and save data at the same time.

 

Look into the Stream to TDMS function in the DAQmx palette.  This is a way to bypass the program level and get a data log file.  The data format will be TDMS and not a CSV.  But there is a plugin to read TDMS files in Excel.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(2,822 Views)

That's very helpful!

Thank you so much.

0 Kudos
Message 3 of 3
(2,808 Views)