LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Handle 3 tasks by their "taskName"s

Hello,

 

first of all I just want to say hi and introduce myself:

 

I'm student, work at the moment for a company and write my bachelor thesis. I work for half a year with different NI-DAQs, but never had to use more than one analogue in- or output.

 

So I'm a bit confused, because I need to handle 3 tasks for my new project, but have to use them by their "taskHandle"s ... This is a bit problematic, because I want to use all the time just one name for "taskHandle" and use the tasks by their "taskName"s.

 

For example:

 

Initialization

 

DAQmxCreateTask("SpeedVoltage",&taskHandle);
DAQmxCreateAOVoltageChan(taskHandle,.....)
...
 
DAQmxCreateTask("DirectionVoltage",&taslHandle);
DAQmxCreateAIVoltageChan(taskHandle,....);
...
 
Program
 
DAQmx + Anything that let me save "SpeedVoltage" as taskhandle;
DAQmxStartTask(taskHandle);
 
Maybe you've any clue for me. If this isn't possbile, I've to use different taskHandles, what makes my program much more complicated than it has to be.
 
Sincerely
Andreas
0 Kudos
Message 1 of 3
(3,183 Views)

I see no real utility in using the task name. All DAQmx functions need the task handle to operate on a task and there is no function I know of that can retrieve the handle associated to a specific task name. Keep also in mind that the task name could be changed internally by DAQmxCreateTask () as you can see in the help.

You can create and store your tasks in MAX: DAQmxLoadTask can then retrieve the tasks by name, but after this moment all the matter will be managed using the task handle returned by the function.

 

I also see no such complication in using three different variables to store the handles for the tasks you are using in your program.

Can you detail a bit more your application and explain why you don't want to rely on the task handles?



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?
Message 2 of 3
(3,179 Views)

Thank you for this fast response.

 

Well eitherway I'd have to create just one TaskHandle and could've spared 3-4 other Taskhandles.

 

It could look like:

 

TaskHandle taskHandle

 

but now it looks like:

 

TaskHandle taskHandle1;

TaskHandle taskHandle2;

TaskHandle taskHandle3;

etc. pp.

 

And well I'd have changed this TaskHandle everytime, but inside these tasks it'd be the same all the time. I was looking for a function like:

 

DAQmxUseTask("TASK ONE",&taskHandle);

DAQmx ......... ("TASK ONE",...,...,)

...

 

DAQmxUseTask("TASK TWO",&taskHandle);

DAQmx ......... ("TASK TWO",...,...,)

...

 

So if I've a big project with 20 different tasks I'll need 20 different TaskHandle's than just one.

 

But if there's no function I'll have to use it this way.

0 Kudos
Message 3 of 3
(3,157 Views)