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: 

How to dynamically program the DAQ?

Solved!
Go to solution

As the question sounds, I want to dynamically change parameters of a DAQ card (DAQmx). The idea is to have a one while loop doing GUI event caputures and other while loop responding to the DAQ events. It is somthing like PRODUCER-CONSUMER loops. However, I can achieve  set everything thing once but not on the fly. Any suggestions as to how we can achieve this?

 

Thanks

RY
0 Kudos
Message 1 of 5
(2,544 Views)

You may need to stop the task and then start it again. Post your code please.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 5
(2,538 Views)

Here is the code.I try to stop the DAQmx TASK but it doesnt work. I want to change number of channels, sampling rate etc from the GUI dynamically.

RY
0 Kudos
Message 3 of 5
(2,517 Views)

Your code isn't messy, but is convoluted.  If you want to choose the number of signals being sampled, then provide an array of channels to sample from instead of just one.  Give the array to the DAQmx Flatten Channel String function to flatten it into a single string that can be passed into the Physical Channels to read.  This can only be done if a task is not running on the card.  You'll need to stop the task to do change these settings then start the task.  It looks like you already have the sample rate control, again just ensure that a task isn't running.

0 Kudos
Message 4 of 5
(2,495 Views)
Solution
Accepted by topic author VEEDAY

Thanks for the feedback. I have resolved the issue by traditional approach. Here is the working GUI.

RY
0 Kudos
Message 5 of 5
(2,483 Views)