Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

DAQmx access interface


After getting to know that developing in C++ without Measurement Studio is possible I am facing the problem of creating access interface to NI USB-6259 device. Does anybody have similar experience? I am thinking of making dynamic link library (dll) that will provide such interface to control this device. Some kind of task manager will be required but dividing taks into class tree seems to be kind a tricky. Any help is appreciated.



Dariusz Boczkowski 

0 Kudos
Message 1 of 12

Well, please clear some of confusions that created after checking the possibilities of USB-6259:

1) Is it possible to run any two task simultaneusly on the device? From my small experience it's not possible but duplicating the same taks might not be an answer.

2) When I try to do 1) I get an error -50103: The specified resource is reserved. The operation could not be completed as specified. How to interpret this error.


It might a little bit difficult to develop access library with at least most functionalities of the DAQmx driver... 

0 Kudos
Message 2 of 12

Ok, I found out what is the problem with this error. But it revealed some limitation of using the USB-6259 device. I would like to create an environment with the possiblity of defining any task and running them at any time. But each task could be launched separately. Is it possible? Right now my knowledge is this won't be able. If so what kind of task types can not be run simultanously or where to find such information? Just to implement some kind of scheduling in the library....


Thanks in advance! 

0 Kudos
Message 3 of 12
Hi Dariusz, I found the KB on the, where is described the reasons, that can cause your problem. I found some more information, that could helped:It is not possible to have multiple DAQmx tasks attempting to access the same physical device. Thus it is necessary to clear each task after the data acquisition has completed. You have to configure one multiple channel task.For example:Concurrently running two analog input or two analog output tasks.  This error can also be thrown when a program explicitly calls multiple tasks performing the same type of operation at the same time. As with the other two cases, this produces a situation where multiple independent tasks are concurrently attempting to access the same resource. Even though the tasks might be using different channels, this is still a conflict because they require use of the same analog to digital converter and sample clock. To resolve this issue, combine all operations of the same type into the same task. For DAQmx 7.3 and later, it is possible to do this even with multiple types of analog input if you use multiple DAQmx Create Channel VIs.Regards,Jiri KeprtJiří Keprt | Application Engineer


0 Kudos
Message 4 of 12

Thanks for reply!

I had already read the article in KB you have provided me. I know the problem is when more than one task uses the same resource in the device. I would rather get to know how to manage the task (of any type) that can occur at any time.Unreasonable is to stop one channel then add next one and run multiple channel task again. A cannot assure that these tasks will show up in the same time to organise them into one multichannel task. So far the only way I can see is to queue the tasks of the same type...  

0 Kudos
Message 5 of 12

Hi Dariusz,


I am afraid, that there is not easy way how to manage the application with task that can occure in any time on any channel.

Unreasonable is to stop one channel then add next one and run multiple channel task again - this is exactly behaviour of the drivers. Because you are using the multiplexed M series card, the driver according to number of channel sets up

the multiplexer and the transfer of the data. So I think, that from the basis of the driver and multiplexer you are not able to add another channel to running channel. If you need this behaviour, you may use the simultaneous sampling card.

The solutions with the queue of aggregation of similar tasks could be the way, but it still supposes, the you will start those tasks in the same time or you must stop running task and reorganize to new multichannel task. 






Jiří Keprt | Application Engineer


0 Kudos
Message 6 of 12

Ok, I agreed I must manage the limitation with using simultanous tasks, but which function of DAQmx C provide channel combining? I have found only DAQmxCreateTEDS function group. Is this the only way? What about adding digital channel to analog one?


Best regards. 

0 Kudos
Message 7 of 12

Hi Dariusz,

here are some examples in CVI, that documents your problem. The first example shows how to acquire data from multiple channels.

You can run this example and select more than one channel to measure.

You can create the task for AI for more than one channel for example:

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle,chan,"",DAQmx_Val_Cfg_Default,min,max,DAQmx_Val_Volts,NULL));

This example shows how to create more the one task on one device and start it simultaneously

You can run more than one task on one device, but the task must be of different type. It is shown in the example.

 (For example you can run analog input task and analog output task on one device, but you can’t run two analog input tasks on one device).

So you have to manage it and aggregate it per task type (f.e. analog input).





0 Kudos
Message 8 of 12
Unfortunately the given links don't work. 404 error occurs...
0 Kudos
Message 9 of 12

Hi Dariusz,


the links in my browser works fine. Anyway you can find the according the name in the search window.

NI-DAQmx: Continuously Acquire From Multiple Channels and Save To Spreadsheet File


DAQmx - Acquiring Data From Multiple Channels and Saving To a Spreadsheet File


DAQmx - Simultaneously Started Analog Input and Output using CVI





0 Kudos
Message 10 of 12