From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real-Time Updating DAQ Parameters

Solved!
Go to solution

I created a program to read the input of analogs channels and store the data into an Excel file. The program working so far, however, the problem is, whenever I need to update the DAQ Assistant Parameters (Sample Rate and Number of Sample), I need to turn off the program (by pressing the "STOP" Abort Execution Icon) and then enter the desired values, then run the program again.

Sample Rate and Number of Sample are controlled by numeric input control. My question is, how would I implement a "real-time" update button to set the new number of sample and sample rate of the DAQ while DAQ is running?  As I am new to LabVIEW (2 days experience), an explanation with a sample VI would be much helpful.

 

 

 

0 Kudos
Message 1 of 6
(2,332 Views)
Solution
Accepted by topic author RVL2010

You could use the lower level DAQmx functions as in the numerous shipping examples (Help>Find Examples) but you cannot change these parameters on the fly. You have to stop the running task before you can change the sample rate.

Message 2 of 6
(2,324 Views)

I have another small question, for my problem, please reference for earlier attachment. When the program first run, I press "ON", the programs starts to acquire the signal with Sample Rate and Number of Sample I provided, when I releases the button (ON->OFF), the program stops sampling=> perfectly fine.  The problem happen when I turn on the program again with new parameters of Sample Rate and Number of Sample: Although the program starts to acquire the data, it does not run with new parameters.   I can use the "Abort Execution" to stop program, enter new parameters, and start the program again but this is so annoying.

 

Please help me

 

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

No. As far as I know, you are not stopping the task. The DAQ Assistant hides so much and I never use it. Look at the low level functions a a state machine where you can stop and start a new task.

Message 4 of 6
(2,296 Views)

In addition to what Dennis said, many NI-DAQmx devices support changing the sample rate while the task is running. I don't know of a document that lists which devices support this, but E Series and M Series support it for AO and X Series supports it for AI, AO, and DIO. There is a shipping example called "Cont Gen Voltage Wfm-Int Clk-Variable Rate.vi" which demonstrates this feature for AO, but basically it involves setting the SampClk.Rate property while the task is running.

 

Brad

---
Brad Keryan
NI R&D
Message 5 of 6
(2,289 Views)

After 2 hours of reading and trying Smiley Very Happy, I got the stuff work. Thank you very much. It is kind of difficult as I do not have much experience (3 days) and yes, I can update the stuff in "almost real-time"

 

Again, I am very much appreciated Dennis Kutson and Brad K for all the suggestion.

 

0 Kudos
Message 6 of 6
(2,284 Views)