Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Wait Until Done takes an extra 100ms

   I am using LV 8 on W2K.  I am making a 1ms wide pulse with CTR0 on a PXI-6259.  If I put a DAQmx Wait Until Done after the pulse generation and before clearing the Task, it takes 100ms ;to return from DAQmx Wait Until Done.  If I try to generate a second pulse as soon as possible after the first, I can't get them any closer than 100ms or so.
   I remove the DAQmx Wait Until Done, generate a pulse, clear the task, generate another pulse immediately thereafter, and it works.  No errors, so the task must have finished OK.  Any idea why DAQmx Wait Until Done takes so long to return?  I have seen the same thing by starting the task and then polling DAQmx Is Task Done?.

Regards,
   DaveT
-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
Message 1 of 11
(5,596 Views)
Hello Dave,

The DAQmx Wait Until Done function and Is Task Done function polls the status of the task on your DAQ card.  This polling occurs at a rate of 10Hz (or every 100ms).  There is no way to change this. 

You mentioned that you are generating a pulse and clearing the task immediately after and then generating another pulse.  I would expect this not to return any errors, but if you are not careful you can stop the pulse from finishing.  To test this, create a pulse that has a high and low time of half a second and clear the task after the start task.  You will see the pulse goes high and then low very quickly.  It does not finish the 1 second pulse.

I hope this clarifies things.

Regards,

Jesse O.
Applications Engineering
National Instruments

Jesse O. | National Instruments R&D
Message 2 of 11
(5,556 Views)
Jesse,
    Thanks for verifying this, so that I know I'm not doing something wrong.
    My assumption at seeing these functions is that they would use an interupt from the hardware to determine when the task is done, rather than doing polling.  If they are polling, I can see that you might not want them running much more than 10 Hz.  Is there any plan for improving this in the future?  Or is there still support for Daq events?  I haven't worked with Daq Events in DAQmx, but in Trad NIDaq, I thought it was possible to get events to fire upon completion of certain DAQ tasks.  Is an interupt-based solution available through some sort of Event interface?

Thanks,
   Dave
-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 3 of 11
(5,558 Views)
Dave,

DAQmx 8.x with LabVIEW 8 does support events.  The event you can use is the DONE event.  It is similar to the Wait Until Done or Is Task Done.  The event is thrown when the task completes.  I tested this out, and I am still getting times around 100ms.

If you would like to see how DAQmx events work in LabVIEW 8, there are some example in NI Example Finder under Hardware Input and Output >> DAQmx >> Events.

If you would like to see a variable/user settable polling rate on the wait until done function, you can create a product suggestion here.  These go to our R & D department to look at.

Regards,

Jesse O.
Applications Engineering
National Instruments

Message Edited by Jesse O on 06-06-2006 09:56 AM

Jesse O. | National Instruments R&D
0 Kudos
Message 4 of 11
(5,541 Views)
Correction needed here.  Wait until done does not poll.  What happens is that when the acquisition completes or is stopped the wait until done internal synchronization object is signaled (set) and the VI returns.  There is a configurable timeout on this VI which is by default 10seconds.  Are you sure you haven't set this?  Is tasks done is a pollable call, but it does not poll itself.  It checks a value internally and immediately returns.  However, it looks like you are using  wait until done so you wouldn't run into this.  Another idea we have is that there might be unknown sideaffects in the way your application is setup which makes it look like our driver is polling for some reason, but it is not designed to do so.  am not sure where Jesse O got the info.
 
StuartG
0 Kudos
Message 5 of 11
(5,526 Views)
Stuart,
    Interesting information.  Actually, I tried both Wait Until Done and Is Done?, and both took 100ms.  Also, Jesse apparently tested these functions and came up with the same 100ms.

Dave
-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 6 of 11
(5,524 Views)
Dave,

Jesse and Stuart are both correct, but they are talking about different software layers in the DAQmx driver. The DAQmx Wait Until Done and DAQmx Is Task Done functions are event driven, and do not poll. However, for pulse generation, the STC and TIO / M Series counter drivers use a thread to poll the hardware every 100 ms. When this thread sees that the pulse generation is complete, then it signals the done event. This explains the 100 ms granularity you have seen with the DAQmx done query functions, and you should see the same granularity if you register for the done event using a LabVIEW event structure.

Also, this only pertains to counter output, not other channel types.

Message Edited by Brad K on 06-06-2006 05:06 PM

---
Brad Keryan
NI R&D
Message 7 of 11
(5,490 Views)
Brad,
   Thanks for the clarification.  Thanks to all three of you for the information.

Dave
-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 8 of 11
(5,481 Views)

Dave...sorry for all the confusion on this issue.

 

StuartG

0 Kudos
Message 9 of 11
(5,457 Views)
A quick update on this issue.  As of DAQmx 8.7 this should be largely alleviated.  The underlying problem is still there, but we try a bit harder to poll at an interval that matches your pulse output.
------
Zach Hindes
NI R&D
0 Kudos
Message 10 of 11
(4,841 Views)