Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQmx Code Example (C/C++) for reading 8 differential analog inputs on USB-6215?

Solved!
Go to solution

Are there any examples using the NI-DAQmx C/C++ API in an application that illustrate how to read all 8 analog channels (differential) on a USB-6215 or similar device?  I can find examples to read a single channel, but nothing for multiple channels.  When I try to read all 8 channels, I only get input on the first channel.  Any help would be appreciated.

 

Regards,

Bob

Message 1 of 10
(16,676 Views)

Hello Bob,

 

Thank you for using NI forums.  What you would need to do is use a range of channels in your create analog input function.  There is a character input called physicalChannel[] and this is where you specify what channels this task applies to.  If you wanted to sample more than one channel then you could use something like "Dev0/ai0:7".   This will configure your analog task for channels 0-7.  Try this out and let me know if you encounter any problems.

 

Regards,

Message 2 of 10
(16,658 Views)
Solution
Accepted by topic author rhenders

Brandon:

 

Thanks for the advice.  I have it working now.

 

Regards,

Bob

0 Kudos
Message 3 of 10
(16,650 Views)

i,

 

i've a same problem with this topic.

 

i've 2 channel input..and i've used this method ai1:2..But it mixed or merged together into 1 graph..

 

what i want is to appear these data seperated

 

ai1 appear in 1 graph and ai2 appear in 1 graph too..

 

how can i seperate this?

 

Hope help,

 

Thanks before

0 Kudos
Message 4 of 10
(16,441 Views)

Have you switched to C/C++ since your last post?

 

Since your question is unrelated to the original question, you should have started a new thread. To show the signals in separate graphs, you would use the Index Array function on the output of the DAQmx Read.

0 Kudos
Message 5 of 10
(16,436 Views)

Hi,

I have the same Project and want to acquire multiple channels synchronously in C++. First of all I tried to use multi threading but thanks your forum I've got that I was wrong. In order to obtain and save these data I have written "Dev1/ai0:1" as 5th parameter of the function "DAQmxReadAnalog64" and I've changed the definition of the parameter, in which data will be saved to a 2-D Array as "float64 data[2000][2]".But I face the error:

cannot convert parameter 5 from float64[2000][2] to float64[]

Sure it is due to the definition of the function "DAQmxReadAnalog64" which gets 1-D Array as 5th parameter. Whould you Plz help me how can I get acquiered data from multi channels and save them for example in a 2-D Array?

best regards,

Mohammad

0 Kudos
Message 6 of 10
(14,601 Views)

Hello Harati,

 

You should check this DAQmx reference help:

http://zone.ni.com/reference/en-XX/help/370471W-01/daqmxcfunc/daqmxreadanalogf64/

 

*There you can read for "read array" description: The array to read samples into, organized according to fillMode.

 

FillMode: Specifies whether or not the samples are interleaved.

 

Interleaving: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/interleaving/

 

Regards

0 Kudos
Message 7 of 10
(14,578 Views)

Dear frind,

i wrote a program in VC++ which acquires some analog voltage channels using NIDAQmx. By means of the "DAQmxCreateAIVoltageChan()" function it works properly, but I've faced a question:

When I measure a sine wave as a input channel whith diffrential terminals (pins) on NI-Device, there is no problem but if I connect the input signal in single ended form (connect input signal to each single terminal and connect GND of NI-Device and Signal generator together), there is a irrigular and alternative offset (DC value) in aqcuiered data that shows there is an error in connection of GND's. (I'm sure about function generators)

Is there any specific function to assign exactly that input data should be measured in differential or single ended form? I mean, should I write seperate codes in C++, if I want to measure input signal in both forms of differential and single ended or does the mentioned function satisfy both needs (if so wherefrom does this fault emerge)?

Thanks a lot for your helpfully reply in advance,

yours,

Mohammad

0 Kudos
Message 8 of 10
(14,218 Views)

Hello
I'm interested in programming analog input data set (multiple entries) that came from piezoelectric sensors, for this I use C + + buider 6.0.

Could you share some code?, I thank you in advance.

0 Kudos
Message 9 of 10
(13,726 Views)

Hello wecj,

 

You can find examples for C++ using NI-DAQmx, you can open them by navigating to Start>>All Programs>>National Instruments>>NI-DAQ>>Text-Base Code Support. You can use the examples and select several channels from your device and then read from all those channels.

0 Kudos
Message 10 of 10
(13,703 Views)