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,580 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,556 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.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 4
(3,551 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,502 Views)