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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition: task specified does not exist


I am trying to do an analog read.   Apparently in the original code (which I did not write), the data acquisiton is a multithreaded task. (I am not a real programmer, so know next to nothing about multithreading, and not a whole lot about programming)...

 

When I tried to collect data (by pressing our "Data Collect" button on the GUI, I got an error along the lines of:

"Task specified is invalid or does not exist. Status Code: -200088"

I have figured out that the task the error refers to is called SetCollectData, for which I am not able to find a definition.

It runs fine when I comment that line out, but of course, no data gets collected!

 

Here is the actual data acquisition portion of the code:

 

if(DAQInputTask && ) GetCollectData())
            {
                if((AiData = malloc(sampsPerChan*AiNumChannels*sizeof(float64))) == NULL )
                {
                    MessagePopup("Error","Not enough memory");
                    goto Error;
                }
                DAQmxErrChk(DAQmxReadAnalogF64(DAQInputTask,-1,0,DAQmx_Val_GroupByScanNumber,AiData,sampsPerChan*AiNumChannels,&numRead,NULL));
                fwrite (AiData, sizeof(float64), sampsPerChan*AiNumChannels, AiRawData);

       *AiData = NULL;

}

 

Any ideas?

I have switched to NIDAQmx drivers, and have had a host of problems since switching to DAQmx functions.  So, this new problem may still be related. 

 

Thanks!

0 Kudos
Message 1 of 4
(4,297 Views)

Tasks in CVI are the basic of data acquisition: every operation is run under a task which groups channel definition, triggers, acquisition rate and almost every other element which constitues an acquisition process.

 

You should try to find informations about the tasks used in your project, possibly asking the original programmer; on the same time, you should learn some infos about how daqmx treats data acquisition process. Here you can find the help page related to tasks: I suggest you read that page and use it as a starting point for your search. Keep in mind that a task can be defined either inside the program or within MAX. One possible cause for not finding the task while running the program is that is has been defined in MAX on one machine and you have moved the project to another one without moving MAX informations too from the original PC, but this is only a guess.

 

It's not clear from your words whether you are modifying an existing project developed in DAQMx from the beginning or you are moving an old NI-DAQ project to DAQMx. These are very different scenarios. In every case you should see the exact line where the error arises, look for the task handle used in that line (e.g. 'DAQInputTask' in the code you posted) and find the line where the task is loaded/created (ultimately try a search for that variable name in all your source files and examine each line where it si used).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(4,291 Views)

Thank you, Robert.

 

I did search for that "SetCollectData" in all my source files but could not find it.

I also tried doing a search in the libraries, and got 0 hits

 

The code was originally written by someone else who can no longer be located, and it was written in Traditional NI-DAQ.

I needed to interface the program with new (DAQmx) NIDAQ boards, so I had to convert the orginal code to DAQmx.

 

I'll do some more reading up on tasks, etc.

THanks again for your willingness to help out.

0 Kudos
Message 3 of 4
(4,273 Views)

Well, this can explain some things: the concept of task is new to DAQmx, Traditional DAQ does not organize operations in tasks so you may need to rewrite portions of the code including the new concepts like creating and handling tasks. This white paper can help you a little:

 

Transitioning from Traditional NI-DAQ (Legacy) to NI-DAQmx Using ANSI C and NI LabWindows™/CVI



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(4,269 Views)