LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I convert the Voltage - Continuous Output.vi example to control multiple channels at once?

I changed the channel to an array (7 channels) and used DAQmx Flatten Channel String.vi, but I cannot get the Analog 1D Wfm NChan Nsamp to work without error. I changed it to Analog 2D Wfm NChan Nsamp and made a 7 waveform 2D array of data, but I always get an error.

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

Please (a) attach code (VIs, not a .JPG), (b) tell us what version of LabVIEW you are using, (c) describe the DAQ equipment you are using, and (d) tell us the sampling parameters (sampling rate, etc.).

 

Bob Schor

0 Kudos
Message 2 of 7
(3,281 Views)

I don't understand what you did. You don't need to create an array. The syntax is simply like Dev1/ai0:6 for 7 channels.

If you get an error with Nsamp/Nchan and 1D waveform, you needed to provide the error code/message. Silly to try and guess what it is.

0 Kudos
Message 3 of 7
(3,267 Views)

The code is a standard LV example (LabVIEW>Help>Find Examples>Hardware Input and Output>DAQmx>Analog Output>Voltage - Continuous Output.vi).

 

I tried changing the channel control to a constant PXI1Slot3/ao2:8 and still got the following error:

 

Error -200524   The number of channels in the data does not match the number of channels in the task.

 

Previously, I tried, without success, to get the waveform generation loop to generate 7 waveforms and I tried building an array of 7 waveforms, but the "DAQmx Write Analog 1D Wfm NChan Nsamp" still throws an error. As noted previously, I tried changing this to 2D Wfm without success.

0 Kudos
Message 4 of 7
(3,213 Views)
You didn't mention that you were using analog output. When you increase the number of channels in the task, you must also increase the number of elements in the array that you want to write. For example, you specified 8 channels to write so you need to pass a 1D waveform with 8 elements.
0 Kudos
Message 6 of 7
(3,199 Views)

Sorry, I thought that the subject title would indicate that I was doing output.

 

I also played around some more and solved the problem. I had to make 7 entries in the Waveform Array block. I had assumed that the for loop would run the proper number of times since I was specifying 7 channels. Once I made 7 entries in the Waveform Array block, it worked properly.

 

Thanks for the help.

0 Kudos
Message 7 of 7
(3,181 Views)