LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to acquire and log N number of samples at a specific repetition rate and write to file

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

0 Kudos
Message 1 of 6
(2,793 Views)

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.


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
0 Kudos
Message 2 of 6
(2,788 Views)

We're using an NI DAQ USB-6361, and writing to TDMS or binary is fine.  

0 Kudos
Message 3 of 6
(2,773 Views)

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.


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
0 Kudos
Message 4 of 6
(2,765 Views)

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.

0 Kudos
Message 5 of 6
(2,704 Views)

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.


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
0 Kudos
Message 6 of 6
(2,652 Views)