12-22-2012 09:20 PM
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.
Solved! Go to Solution.
12-23-2012
06:17 PM
- last edited on
05-15-2025
11:22 AM
by
Content Cleaner
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.
12-23-2012 10:12 PM
That's very helpful!
Thank you so much.