LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

AO Task is Done despite running generation

I check with Task is Done successfully if a Task was already started for AI and DO tasks. However, an started AO task, without timing configuration returns immediately after start: task is done, despite the hardware is generating at that moment. A following start returns an error, since it is already running. Yes, what a beauty. 

 

Ok, how can I retrieve the running status without clearing errors?

 

Actor Framework
0 Kudos
Message 1 of 11
(647 Views)

If you call DAQmx Start VI, the task is running when that VI is done executing and returns no error.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
Message 2 of 11
(617 Views)

 


... However, an started AO task, without timing configuration returns immediately after start: task is done, despite the hardware is generating at that moment.

What is the default ao timing for your device? That default might explain how you can have a task where Task is Done returns and the hardware is still generating.

 

This reference doesn't go into enough detail for task types like hardware-timed single point, but at least it indicates that we might expect different behaviors for different timing configurations. This reference describes the DAQmx task state model. I also wish there was a direct way to query the driver for the current state of the task.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 3 of 11
(606 Views)

@ZYOng wrote:

If you call DAQmx Start VI, the task is running when that VI is done executing and returns no error.


I was referring to the 'Is Task Done.vi' which returns true despite the started hardware still generating voltage.

 

I am using 9264

 

There is this kb https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000gO3kCAE&l=de-DE

describing a solution calling s library, which is OKish, BUT I need that for RT linux (cRIO)

Can someone verify that not configuring timing is the same as 'Simultaneous Analog Output Enable'?

Actor Framework
0 Kudos
Message 4 of 11
(598 Views)

@Quiztus2 wrote:

@ZYOng wrote:

If you call DAQmx Start VI, the task is running when that VI is done executing and returns no error.


I was referring to the 'Is Task Done.vi' which returns true despite the started hardware still generating voltage.


NI hardware keeps the last value even when the task is cleared. You need to write a 0 value explicitly to let it "stop generating voltage". See How Can I Reset to Zero My Analog Output Value After I Stopped My Application?

 

What are you trying to monitor? Perhaps you want to use Wait Until Done VI instead? 

Difference Between the DAQmx Wait Until Done VI and Daqmx Is Task Done VI

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
Message 5 of 11
(572 Views)

I have async parallel tasks which share the device. They have no knowledge if the device was already started. I mean I could find a way around this, but I find it counterintuitive not to be able to figure out if the device was already started.

Actor Framework
0 Kudos
Message 6 of 11
(532 Views)

@Quiztus2 wrote:

I have async parallel tasks which share the device. They have no knowledge if the device was already started. I mean I could find a way around this, but I find it counterintuitive not to be able to figure out if the device was already started.


async parallel tasks? Do you mean parallel processes/VIs that all use the same DAQmx task? Or different DAQmx tasks that use the same device?

Could each async parallel task have its own task? If there is another task running on the device, and one tries to start another task that uses a shared resource already in use, DAQmx returns the following error:

Error -50103: occurred at ...
Possible reason(s):
The specified resource is reserved. The operation could not be completed as specified.

Handling this error seems more robust than querying a particular task's status.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 7 of 11
(516 Views)

Sorry, that was misleading. Parallel processes share one DAQmx Task. I think some piece of AO device should be able to tell if it's currently generating. Also on RT Linux

Actor Framework
0 Kudos
Message 8 of 11
(500 Views)

Is this an unbuffered software-timed AO task (a.k.a. on-demand or immediate mode)?   What do these parallel processes want to *do* with the task?

 

If you just need to call DAQmx Write from these parallel processes to update the AO value, you could make a very simple wrapper function that's *NOT* re-entrant.  Then you can be sure that only one of the processes gets access to the hardware at a time.

 

If the problem you're having is something else, you'll need to spell out more about your task, your app, and your reasons for architecting this way.  What I'm picturing has a kind of "code smell" that's kinda similar to global variable race conditions.   Here the AO voltage is kinda like a global variable -- lots of processes "race" to set it when they happen to feel like it, and whoever happens to set it last wins.

 

 

-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 9 of 11
(492 Views)

Thanks for your feedback. You are right, that this behaviour is not a show stopper at all and that there are ways around.

 

My point is, that it is reasonable to expect that one can query if one device is currently generating. NI backs this:


Using Is Task Done

You can use the Is Task Done function/VI for applications in which you need to monitor the progress of a task running in one section of your application from another section of your application.

 


Actor Framework
0 Kudos
Message 10 of 11
(487 Views)