Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

multi-channel analog output with "DAQmx Write"

Hi,

 

I tried to generate pre-defined voltage samples using the analog output ports on my USB-6259.

 

The pattern length for my project is 6 minutes at 10KHz, so the pattern file is 6(min) x 60(sec) x 10K(Hz) = 3,600,000 samples. The value of these voltage samples are writen in a text file. 

 

I programmed a VI which works for one channel AO previously, but when our project need three to four output channels simultaneously, I have difficulty trying to make modifying the one channel VI into multi-channel. 

 

After some debugging, I'm sure the 2D array was successfully read in from the text file, as I can probe it from the output of the "Spreadsheet String to Array  Function." I feel that the problem is at the "DAQmx Write" when I set it to "Analog 2D DBL NChan NSamp", there was just no output at all. 

 

The VI is attached (after I tried to make it multi-channel). Hopefully someone can give me some suggestion. 

 

System: Windows Vista Business

LabVIEW: 8.6

DAQ: USB-6259

 

 

 

 

0 Kudos
Message 1 of 5
(6,677 Views)

Hello Kuanfu,

 

To answer your question correctly, what does your array data set look like? i.e. please note that the DAQmx Write VI, Analog 2D DBL N Chan NSamp, data input takes a 2D array of samples to write to the task. Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task. Also, is the pattern repeating or do you have 3,600,000 samples? What are you using as your Clock Source?

 

Best regards,

 

Ali M

Applications Engineer

National Instruments

0 Kudos
Message 2 of 5
(6,646 Views)

Hi, Ali,

 

The file I feed into this VI as the array data looks like this: 

 

1.0    2.0    3.0    4.0
4.0    3.0    2.0    1.0
1.0    2.0    3.0    4.0
4.0    3.0    2.0    1.0
1.0    2.0    3.0    4.0

 

 

A file which I used for debugging is attached. In real case, the 3,600,000 sample pattern will be a very long file, and the pattern does not repeat.

 

I use a Agilient function generator to provide a 10KHz, 5V peak-to-peak clock (0 to 5V). 

 

 

Sincerely,

Kuanfu

 

 

 

 

0 Kudos
Message 3 of 5
(6,637 Views)

Hello Kuanfu,

 

To test writing to multiple channels, you can directly wire an array constant in the DAQmx Write VI i.e. without using the file reading VI's. Keep in mind that each row corresponds to a channel in the task and each column corresponds to a sample to write to each channel (see image below). Assuming that each of the columns in your example data set is a row, an alternative method would be to place each of the columns in MS Excel, then use the Transpose 2D Array VI between the output of the Spreadsheet String to Array VI and the input of the DAQmx Write VI. Leave the Clock Source input unwired to use the default onboard clock of the device. Also to utilize the Front Panel stop button, right click on the ege of the For Loop in the Block Diagram and select Conditional Terminal; wire the output of the 'Or' function to the Conditional Terminal input. (I was able to output data successfully from more than 1 channel and measure readings (using a DMM) with your code/data set using the steps outlined above). 

 

Best Regards,

 

Ali M

Applications Engineer

National Instruments

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

Hi. I set up the VI following your instruction but I found that the waveform detected in the oscilloscope was not stable that the oscilloscope are kept in scan mode. 

0 Kudos
Message 5 of 5
(2,337 Views)