07-22-2015 01:40 PM - edited 07-22-2015 01:48 PM
Hello,
I am interested in acquiring N number of samples (e.g., 10000) at a specific acquistion rate (e.g., 1MHz), and writing this data to file - and repeating this acquisition/logging at a specific repetition rate (e.g., 50Hz). Pretty straightforward I think, but I am unsure of how to go about doing this in order to maximize the repetition rate.
Any insight is appreciated!
Thanks,
Vic
07-22-2015 01:52 PM
What are you using to acquire these samples? NI Data Acquisition card? DMM? Oscilloscope?
What data format do you want? Text file? Binary? TDMS?
This would be most easily done with an NI DAQ and writing to TDMS.
07-22-2015 02:09 PM
We're using an NI DAQ USB-6361, and writing to TDMS or binary is fine.
07-22-2015 02:15 PM
First thing's first: get the acquire and log working.
Look in the example finder for a simple Analog Input (don't remember the exact name right now). You will want to configure the task to be Finite Samples. So you acquire N samples at Fs rate, read the data, and log it to a TDMS file.
Once you have that working, put it inside of a While loop. Use a wait inside of the loop to regulate how often you run this task. You can actually setup the task before this close and close it out after the loop. Same for the TDMS file.
07-22-2015 04:12 PM
Thanks - is your suggestion the optimal way to do it? It is definitely the easiest way, but I find that dropping the process of task starting and stopping into a while loop consumes a lot of time and reduces the repetition rate.
07-23-2015 08:44 AM
Just running a Finite Samples task takes X time. There is actually little overhead if you already have the task created and read to go.
Of course, your other option is to use a Continuous Sampling task. You would read all of the data that you care about and then read all of the data you don't (may require multiple reads to kep the buffer from overflowing). Since you know the sample rate and the amout of time to throwaway the data, you can calculate the number of samples you ned to throw out.