Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Possible to change sample rate dynamically?

I am running a VI that continually collects data so I can monitor transducer values. When I initiate certain processes, the collected data are written to a file. I would like to sample at different rates for different processes. Is there a way to change the sample rate dynamically, i.e. while the daq process is running? It doesn't seem to make sense to put the DAQmx timing.vi inside the monitoring loop, so my only option right now seems to be to stop my VI and then restart it with new timing values. Perhaps there is some way to request a temporary burst in collection rates?
 
Thanks. 
0 Kudos
Message 1 of 4
(3,133 Views)

Hi km22,

Besides starting and stopping the task every time you need to change the sampling rate, there are some other ways you can vary the analog input sampling rate.  These options, however, will require a little more work to setup. 

    1. The first option is to always sample at the fastest sample rate needed for all the processes, and discard the unwanted data in software to get the equivalent of the slower rate.

    2. Another option is to use an external clock or an onboard counter to generate a pulse train that you will use as the AI sample clock.  You could then vary the external clock or                     counter frequency to adjust the AI sample rate. 


Best Regards

Hani R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,109 Views)
If you *do* use a counter to generate your sample clock, just remember that your AI task won't have automatically have any awareness of the sample rate.  You'll need to manage that variable delta time between samples yourself if it's important in your app.
 
(That said, it's a very useful technique.  Though dynamic sampling rate change on the fly is possible, it isn't something I generally do.  However, I often sync multiple piecewise continuous sampling tasks this way.  I can stop and restart the counter-based sampling clock as needed, and all the other tasks keep all their sample #'s in sync.)
 
-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 4
(3,104 Views)

Thank you, Hani and Kevin, for your suggestions. It's working well for me to simply discard the data I don't need.

Ken

0 Kudos
Message 4 of 4
(3,055 Views)