Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with simultaneously reading multiple AI channels

Hello,

 

I have encountered a problem with simultaneous reading of samples from multiple AI channels on a DAQpad 6251 device, using the .NET API.

 

The problem: when samples are read simultaneously from multiple AI channels using the AnalogMultiChannelReader class, the returned array contains samples with values significantly different then if the samples were obtained non-simultaneously from each of the channels. An example C# code that shows this behavior is given below:

 

Task task = new Task();

task.AIChannels.CreateVoltageChannel("Dev1/ai0:2", string.Empty, AITerminalConfiguration.Differential, -10, 10, AIVoltageUnits.Volts);

task.Timing.ConfigureSampleClock(string.Empty, 1000, SampleClockActiveEdge.Falling, SampleQuantityMode.FiniteSamples);

task.Control(TaskAction.Verify);

AnalogMultiChannelReader reader = new AnalogMultiChannelReader(task.Stream);

double[,] measuredVoltage = reader.ReadMultiSample(1000);

 

When I ran the above program, channels Dev1/ai0 and Dev1/ai2 were left unconnected, while channel Dev1/ai1 was connected to a voltage source of approximately 1.14 V. After the measurement was finished, array ‘measuredVoltage’ contained only values around 1.14, meaning that the unconnected AI channels were also measuring 1.14 V, which is not correct (which I verified by using the Measurement & Automation application to measure voltages on each of the channels).

 

I was able to replicate this behavior (problem) using example project “ContAcqVoltageSamples_IntClk” which comes with the DAQPad device driver.

 

Does anyone have any ideas how to solve this problem i.e. how to get correct simultaneous readings from multiple AI channels? Any help will be highly appreciated.

 

Thanks.

0 Kudos
Message 1 of 2
(3,456 Views)
Bogdan,

Thankyou for posting to the National Instruments Discussion Forums.

The AnalogMultiChannelReader is working fine on my system here - I get correct readings using the ContAcqVoltageSamples_IntClk example with multiple channels.

Your issue maybe the result of unconnected signals - have you tried connecting Dev1/ai0 and Dev1/ai2 to AI GND to make sure they are reading 0V?


Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 2 of 2
(3,442 Views)