10-10-2024 01:07 PM
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?
10-10-2024 07:04 PM
If you call DAQmx Start VI, the task is running when that VI is done executing and returns no error.
10-10-2024 09:07 PM - edited 10-10-2024 09:17 PM
... 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.
10-11-2024 12:08 AM - edited 10-11-2024 01:02 AM
@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'?
10-11-2024 07:28 PM
@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
10-14-2024 02:37 AM
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.
10-14-2024 05:33 PM
@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.
10-15-2024 01:18 AM
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
10-15-2024 06:42 AM
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
10-15-2024 07:02 AM
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.