LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending multiple analog output signals using DAQ assistant

I am relatively new to LabView, so I'll describe as much as I can about the problem.

 

I have a 1D Double array of 4 values that I am trying to write to 4 different pressure transducers using the DAQ assistant. I have added all 4 channels to the DAQ assistant, and I am passing the array as input to DAQ assistant. However, when I try to run it, it gives me

Error 20054

Possible reason(s):
 
Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.
 
When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same number of channels as the data written.
 
Number of Channels in Task: 4
Number of Channels in Data: 1
 
Task Name: _unnamedTask<37F>
 
I cannot figure out why this is happening, since I am passing an array which has 4 values to the DAQ assistant. I use an NI 9264 Analog Output board and a cDAQ 9174 chassis. 
Here is an image showing this part of the code:
Inline image 1
0 Kudos
Message 1 of 6
(4,675 Views)

No Pictures, please -- send Code (preferably Entire Projects after the enclosing Folder has been compressed to a Zip file, otherwise the relevant entire VIs).

 

I never use the Dreaded DAQ Assistant (to give it its full name), so I'm not sure where/how one specifies multiple channels in a DAQ Out task.  But if one configures a multi-channel Task in MAX or in the Project, opens the Task with Start Task, does a DAQmx Write specifying Multiple Channels and Single Sample, puts it in a While Loop to do it multiple times (if desired), then closes the Task with Close Task, this should do what you want.

 

Bob Schor

0 Kudos
Message 2 of 6
(4,668 Views)

Hi,

 

Each channel is looking for an array of values to read in. In the Block Diagram palette under Signal Processing you can find folders for Waveform Generation and Signal Generation. The signals will be DBL arrays.

 

For example, if you are looking to send a pulse signal of a certain value try going to Signal Processing >> Signal Generation >> Pulse Pattern in the Block Diagram palette. The Pulse Pattern function will output a 1D DBL array which can be sent to a single channel. 

 

Each channel needs to be sent it's own signal. To combine the 4 signals, you are going to need to build an array of 4 signals (one for each channel). Each signal will be a DBL array and then you will build an array of these arrays using the Build Array function. The output of Build Array can be the "data" input of the DAQ Assistant. When wired to the DAQ Assistant a Convert To Dynamic Data should take the 2D array and  make it dynamic data for the DAQ Assistant. 

 

Thank you,

 

Angie Cisneros

 

 

0 Kudos
Message 3 of 6
(4,603 Views)

Thanks for your prompt response Bob_Schor. Unfortunately I cannot upload the entire code, since it interfaces with a C++ compiler and has a lot of subVI's. However, I did try what you said, where I used the DAQmx instead of the DAQ Assistant. I do have a question about the write task itself though. If I am passing a 1D array of values to the write task,1) How do you create a multi-channel task in MAX? From what I tried, it just seems to be going back to the DAQ Assistant when I try to do that. Instead, I just listed out the channels, comma separated, as the 'task' input to the Start Task VI. Will this work? 2) Will it write the values in the order I specify the channels? In other words, how does LabView know which value to write to which channel? 

0 Kudos
Message 4 of 6
(4,590 Views)

Hi Angie, I am not trying to send any sort of waveform to the channel. I just have analog voltage values between 1 and 10 volts, and this value changes in every loop of my code. 

0 Kudos
Message 5 of 6
(4,589 Views)

Hi,

 

Would you mind attaching some screenshots of the code? Maybe one of your loop and one of the entire code? In the original post the picture was not added correctly. 

 

To send a single value to be read set Generation Mode to 1 Sample (On Demand) in the DAQ Assistant.

 

Attached is a gif of me working out what I think you are looking to do with a simulated device. 

0 Kudos
Message 6 of 6
(4,581 Views)