Showing results for 
Search instead for 
Did you mean: 

Reading NI USB 6008 from executable

Go to solution

Dear all,

I've tried to find a solution in the existing topics, but could unfortunately not find a fitting solution.

I use a USB 6008 to read out a voltage on ai0. When I run the VI with the USB device connected at my development pc it works fine (DAQ assistant was used to read out the value on ai0). After making an executable on my development pc this also works. However, when I move the executable to the computer on which I want to use it it doesn't read out the voltage. If I startup NI Max I notice that the computer is able to read the value, so physically everything should be fine. To me it seems like some link/connection is missing in the software. Does anyone know what can be missing/faulty in my executable? 


NI DAQmx is installed on the computer on which it should run.

0 Kudos
Message 1 of 10
Accepted by topic author Johan84
09-08-2016 08:32 AM

Is the device and channel named the same way on the deployment PC as it was on your development PC?  Show the MAX screen on each PC and compare.

0 Kudos
Message 2 of 10
Accepted by topic author Johan84
09-08-2016 08:30 AM

You should really avoid "hard-coding" device info into your applications. Make your code dynamic, search for the USB-6008 device, and if it is present on the actual PC, get its actual DEV number and use it for your code! Something like this:



0 Kudos
Message 3 of 10

Thanks for the solutions!


The first one worked for me as the quick and dirty solution to get things working. Thanks!


I'll look into the nicer programming solution as well for my learnings, thanks!

0 Kudos
Message 4 of 10

I like the programming version.  How is this done if you would like to collect data from multiple channels?  I know how to do it through MAX but am trying to improve my coding.




0 Kudos
Message 5 of 10

There's a wonderful White Paper called "Learn 10 Functions in NI-DAQmx ..." (the rest is something like "and handle 90% of your tasks").  Search for the phrase I mentioned on the Web.  There are simple VIs to do exactly what you want shown there.


Bob Schor

0 Kudos
Message 6 of 10

That is a good read and I am putting it in my binder of go to references.  Unfortunatly it did not answer how to do what Blokk did but with 2 AI channels triggered off of PFI0.


Anyone else know?  Blokk?


Ill keep digging. . .

0 Kudos
Message 7 of 10

See the middle of my snippet. It is obvious, just create another CHx string as required for your experiment...


edit: try to put together a VI which will automatically get the dev indexes using a serial number or model name, then creating the Physical channel "descriptors", like this:



0 Kudos
Message 8 of 10



Yes I figured it was something like that but I was unsure what to do with it after that.  In the case you provided Should I then have 2 DAQmx Create Channels within the case statement?  I'll try it tomorrow.


What I found was if you modify your Concatenate string to include ai0:4 it will scan AI0 through AI4.  This works and I have both signals, however I want to apply a scale to just one of them.  I'd like to use the DAQmx Create scale  I am going to continue to tinker.


I should also let it be known that I am trying to trigger both AI0 and AI1 off of PFI0.


Thanks for all the help.  This forum is great.


0 Kudos
Message 9 of 10

Of course you can use 2 or more Create Channels function, and use the same task wire between them. Imagine, you need to use a cDAQ with a voltage and a thermocouple module: one Create virtual channel you specify for voltage, the other for temperature measurement. Using the same task wire, and later a single Read DAQmx function will give you both measurements...

Read that DAQmx reference paper through...

0 Kudos
Message 10 of 10