Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

function isTaskDone howTo?

Hello!

I'm creating an application in C for the NI USB-6009 Multifunction device. (The application will work as a .dll to be called from a VB program.)
I got to the point, where I need to implement a function, that uses the
int32 DAQmxBaseIsTaskDone (TaskHandle taskHandle, bool32 *isTaskDone)
pre defined function. My problem is with this call. It returns 1 (TRUE) if the task has completed but also, if it has not.

Details about my code:
I defined taskHandle as a global variable in the C program:
static TaskHandle taskHandle = 0;
Then I use in different places within the code, in different functions. I only create one task at a time, not any new ones till it has finished.
Where I try to use the isTaskDone function, my code is:
if(taskHandle != 0) //a task has been ever created
{
bool32 isTaskDone = 0;
DAQmyBaseIsTaskDone(taskHandle, &isTaskDone);
if(isTaskDone) //a task is acticve
...
As I have mensioned above, the problem is that the variable isTaskDone always becomes 1, also when there is a task running (sampling from channels).

Could somebody help solving my problem? I can post my code too, if neccessary.

Thanks, motyo
0 Kudos
Message 1 of 4
(3,521 Views)
Since the release of NI-DAQmx 7.5 you shouldn't use NI-DAQmx Base for your USB-6009 device anymore. NI-DAQmx is the standard driver for all NI data acquisition hardware and offers superior functionality and configuration tools (MAX) compared to NI-DAQmx Base. Please refer to this document to learn how to update DAQmx Base applications to DAQmx. You can download NI-DAQmx 7.5 from this location.

Best regards,

Jochen Klier
National Instruments Germany
0 Kudos
Message 2 of 4
(3,511 Views)

Hi, I encountered the same problem as yours. I ran Analog output and I set parameter in CfgSampClkTiming as FiniteSamps. And the task did stop when the data was all wrote. However, the IsTaskDone() didn't  return expected value when it stopped. So have you figured out the reason? Thanks.

0 Kudos
Message 3 of 4
(2,775 Views)

stephan.C,

 

Just wanted to pop in to let you know that this thread is running on 12 years old, and so to get the most up to date help and visibility, I'd strongly recommend creating a new thread with a detailed description of the issue you're seeing. In the meantime, here's an article on the function you mentioned compared to the WaitUntilDone function, which might be better for your use case. Best of luck!

 

 

Claire M.
Technical Support
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 4 of 4
(2,760 Views)