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: 

DAQ task update during running task

Hi,

I hope sombody can answer this question.

 

Is it possible to update a running DAQ task without stopping the task?

In my task I have an analog output and I want to change the amplitude and/or the duty cycle of the output waveform.

 

Stopping the task and starting again with new parameters needs to much time.

 

Thank you,

Robert

0 Kudos
Message 1 of 8
(3,418 Views)

Hi Robert,

 

Yes, you can do that.  This thread shows you how.  The code I show there is written for multi-channel digital output, but you can easily convert it to single-channel analog output.

 

The keys are to use non-regenerative data output and to have your waveform generation VI inside your "write" loop, with controls for amplitude and duty cycle that the user can change from the front panel.

 

Hope this helps,

d

Message Edited by DianeS on 03-25-2010 12:23 PM
Message 2 of 8
(3,411 Views)

There used to be some old DAQ hardware that accepted an analog input to set the gain but lacking one of those and if your output data rate is too fast to go with Diane's suggestion....

 

You could set up two tasks, one that is running and a spare that is not running. You can set the properties of the inactive task, stop the Active Task and then start the previously inactive tasks. switching active task is generally much faster than stoping changing and re-starting just one task.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 8
(3,402 Views)

Interesting, Ben...I never would have thought to do it that way.

 

I actually don't stop and re-start my task in the code I showed...I just feed the task different data for each loop iteration.  Maybe LabVIEW automatically starts and stops the task when it's done that way?  The hardware timing parameters don't change -- just the shape of the output waveform -- so I don't see why the task would have to be stopped and re-started.

 

Anyway...an interesting idea!

0 Kudos
Message 4 of 8
(3,394 Views)

Your solution is better if it meets the reqs. Smiley Wink

 

You could use mine if you want to quickly switch from low speed sampling to high speed, add mor channels, or change gain.

 

I'm just posting alternatives to pad out those seraches of the future.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 8
(3,387 Views)

Ah...I see.  Your solution is a terrific way to do it if there are actual hardware changes which need to be made to the task.  That is really a great idea!  I like it!

 

We'll let the OP decide whose solution will work best for what he wants.  Smiley Happy

0 Kudos
Message 6 of 8
(3,380 Views)

If you're just looking to write new data to the task then there shouldn't be any need to restart it (you can use AO with non-regeneration like DianeS mentioned).  I wanted to make sure to mention that we have an online example that does just this:

 

Update Multiple Channels of Analog Output On-The-Fly

 

 

Additionally, there are some properties that are settable while the task is still running (e.g. AO Sample Rate can actually be changed on-the-fly on many of our Multifunction Boards).  Other properties (e.g. AO Voltage Range) cannot be modified without first stopping the task.  If you need to stop the task and reconfigure, Ben's method is a good idea.  I am aware of an example that does this for Analog Input tasks but I don't think we have one for AO.  Here's the link to an AI version in case anybody is interested (unlike AO, the AI Sample Clock is not changeable on-the-fly):

 

Switching Between Multiple Analog Input Tasks in DAQmx

 

 

 

From what it sounds like, the first link should be exactly what you need and you shouldn't need to worry about restarting your task.  Just add Duty Cycle to the control cluster and wire it into the correspnding input of the Basic Function Generator.  If you have any questions about it or run into any issues don't hesitate to let us know!

 

 

Best Regards,

Message Edited by John P on 03-25-2010 06:35 PM
Message Edited by John P on 03-25-2010 06:36 PM
John Passiak
0 Kudos
Message 7 of 8
(3,356 Views)
Thank you all for your support!! I will provide feedback as soon as I checked the solutions.
0 Kudos
Message 8 of 8
(3,329 Views)