LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling analog inputs

I have PCI  6212
I Set 16 analog inputs.
I have to keep the information in an  16 INPUT TO array of 16x16..

I need to read 16 time the  all 16 analog input and save them.
How do I transfer the  information from 16  inputs into the array?
Is it possible to read all the 16 analog inputs together?
And keep them in an array and then make another call, and save them on the next linearray?

0 Kudos
Message 1 of 7
(1,917 Views)
You can read all channels at once and request multiple samples. This will return a 2D array of x number of rows (equal to the number of requested samples) and 16 columns. You can optionally return a 1D array of waveforms. A setting of NChan 1Samp will return a 1D array. Unless you have timed single sample timing capability and program it, your timing between samples is going to subject to jitter. Better to use NSamp mode with the waveforms so that you have the timing information saved and are actually using the DAQ card as it was intended to be used. Appending new data to old is usually just a matter of a shift register and a build array though this can cause memory allocation problems. If you just want to read and save with each acquisition, then use a producer/consumer architecture.
0 Kudos
Message 2 of 7
(1,906 Views)

Hey,
I wrote a program that should take 16 analog inputs and puts the data in the system.
When I connect 5V to A0, for testing.and  I did not get 5 volts in the first cell array.
Anyone know why? What I have set in DAQ?
Every time I read the 16 analog inputs a0-a15, and keep them in arry .I make it 16 times. Finally received an 16 on 16 arry.

my card is pci 6221 plug to CB-68LP

0 Kudos
Message 3 of 7
(1,719 Views)

Hi Fnachum,

 

Do you get 5V in every other cell except the first one?

 

Try running an AI example VI from NI Example Finder and see if you get the same problem. You can get to the Example Finder at Help -> Find Examples. After the Example Finder is open, click on the Browse Tab then navigate to Hardware Input and Output -> DAQmx -> Analog Input. Depending on your application, you can use the "Voltage - Continuous Input.vi" example or the "Voltage - Finite Input.vi" example. If you want to display the data in an array, just change the polymorphic DAQmx Read vi to 2D DBL.

 

It is also a good practice to create VIs from existing examples instead of building them from scratch, not to mention that it saves time. 

 

There is also a KB on how to do multiple channel data acquisition: http://digital.ni.com/public.nsf/allkb/A3A05920BF915F1486256D210069BE49?OpenDocument

 

Ren H.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 7
(1,695 Views)

When I connect 5V occasion A0 I get all the other entries also Voltage Although the terminals are not connected to anything.

I'm starting to get a different voltage in the others analog input  In  range of 5-10 volts.

Maybe I should make something different settings in DAQ?

0 Kudos
Message 5 of 7
(1,665 Views)

When you have channels with nothing connected to the inputs, you can get a condition called "ghosting" where the voltage on a connected channel seems to appear on a disconnected channel.  This is due to the internal circuitry of the multiplexer in many multi-channel DAQ devices. The solution is to connect the unused channels to some low impedance voltage source within their input ranges. Often ground is used.

 

Searching the Forums for "ghosting" will return many, many hits.

 

Lynn

0 Kudos
Message 6 of 7
(1,645 Views)

I believe this might be the article being referred to.

 

http://digital.ni.com/public.nsf/allkb/73CB0FB296814E2286256FFD00028DDF

 

Basically if the impedance's of your signals are non-ideal, and sampling too fast can cause the value of one reading, to affect the reading of another.  In the past I'd do something like setup my task to sample the same physical channel twice.  This would of course decrease the maximum sampling frequency.  Other solutions involve adding hardware like isolation, or adjusting the impedance so this isn't as much of an issue.

0 Kudos
Message 7 of 7
(1,608 Views)