LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble with multi-channel analog input

I am making a VI with two AO channels, one DO line, and two AI channels.  For some reason, only one AI channel works.  I've tried using both AI channels in the same task, as well as in separate tasks, but I don't know what is wrong with it.  I'm using an M-series card, 6251 and Labview 7.1.  Attached are the I/O VI, and the signal VI.
Download All
0 Kudos
Message 1 of 11
(4,609 Views)
What you've posted certainly won't work because you need to have both channels in a single task. When you tried it with both channels, how did you have your DAQmx Read configured? The type should be Analog>Multiple Channels>Multiple Samples. The example you posted has Single Channel defined. Click on the polymorphic VI selector to change type or right click on DAQmx Read and choose Select Type. When you have multiple channels selected, the data returned will be a 2D array or a 1D waveform data type. The data can be wired to a single graph that will display both channels.
0 Kudos
Message 2 of 11
(4,602 Views)
This is the VI for the two AI channels in the single task.  Of course it was configured for N channels and N samples, but in this case, it does not seem to display meaningful input from either channel.
0 Kudos
Message 3 of 11
(4,601 Views)
I'm not sure what can be wrong. I don't have a DAQ board in my pc right now so I'm running it in simulation mode and I can't use the DAQmx timing. I run just the DAQmx Read, request 1000 samples, and the simulated data looks great.
0 Kudos
Message 4 of 11
(4,593 Views)
With the single task vi, I get the error
--------------------------------------------
Error -200019 occurred at DAQmx Read (Analog 2D DBL NChan NSamp).vi

Possible reason(s):

ADC conversion attempted before the prior conversion was complete.

Increase the period between ADC conversions. If you are using an external clock, check your signal for the presence of noise or glitches.
--------------------------------------------


For the separate task vi, I get the error
---------------------------------------------
Error -50103 occurred at DAQmx Start Task.vi

Possible reason(s):

The specified resource is reserved. The operation could not be completed as specified.

Task Name: _unnamedTask<348>
---------------------------------------------

0 Kudos
Message 5 of 11
(4,583 Views)
I am wondering if it is possible that these problems are caused by both channels trying to access the ADC.  The convert clock has been explained to me as a train of pulses for one channel, and a train of pairs of pulses for two channels.  Is it possible that both channels are trying to use the same convert clock, causing the read VI to fail in the single task by trying to convert two channels at once, and causing one of the start VIs to fail in the two-task version, based on which task reaches the ADC first?
0 Kudos
Message 6 of 11
(4,558 Views)
Both channels have to access the same ADC because there is only a single one. That is why you can't have multiple tasks. The board is designed for multiple channels with a single ADC. Your problem is probably with the external clock source. Have you looked at it to see how clean it is. Have you tried running the AI with the internal clock to see if the error goes away.
0 Kudos
Message 7 of 11
(4,553 Views)
There is no external clock source, it should be running on the internal clock, and I realize both channels have to access the same ADC, but I think the problem is that both channels are trying to access it at the same time (asking it to perform two conversions at once)
0 Kudos
Message 8 of 11
(4,548 Views)
In the VI you posted, the sample clock is set to Dev2/ao/SampleClock. They DAQ board does not do two conversions at once. It does a scan. It first converts channel 0 and then converts channel 1. This is an extremely common task.
0 Kudos
Message 9 of 11
(4,544 Views)
So what I should probably do when I get back to the computer I work on is remove the connection between the Dev2/ao/SampleClock channel constant and the DAQmx Timing vi on the AI task, leaving the constant connected only to the DO task for synchronization, and proceed to give the AO and AI tasks a common start trigger?
0 Kudos
Message 10 of 11
(4,539 Views)